help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sorting using two field separators


From: tolugboji
Subject: Sorting using two field separators
Date: Sun, 17 Oct 2021 16:59:56 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, October 17th, 2021 at 4:47 PM, Alex fxmbsw7 Ratchev 
<fxmbsw7@gmail.com> wrote:

> maybe go a sideway, convert the filenames batchly into has-one-sep, then 
> sort, then change back
>
> On Sun, Oct 17, 2021, 18:29 tolugboji via <help-bash@gnu.org> wrote:
>
>> How can I sort by field if I want to consider two delimiters.
>>
>> For instance, can I sort with the second field with delimiters `-` or `.` 
>> with the following example?
>>
>> schimmel-3.png

I have done the following which functions well

echo -e "04\n05\n06\n07\n08\n1\n2" | sort -n
echo
echo -e "04\n05\n06\n07\n08\n01\n02" | sort -n
echo

giving

1
2
04
05
06
07
08

01
02
04
05
06
07
08

reply via email to

[Prev in Thread] Current Thread [Next in Thread]