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 22:12:07 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

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

> u need also like u tried ors \0 for sort -z later
>
> On Sun, Oct 17, 2021, 23:41 tolugboji tolugboji@protonmail.com wrote:
>
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> >
> > On Sunday, October 17th, 2021 at 9:17 PM, Alex fxmbsw7 Ratchev <
> >
> > fxmbsw7@gmail.com> wrote:
> >
> > > try -v RS='\0' not without -v, try
> > >
> > > awk -v .. '..'
> >
> > You need to be more specific because with
> >
> > | awk -F'[-.]' -v RS='\0' '{print $(NF-1), $0}' |
> >
> > the output is stopping at the first entry.

This is the latest thing I am testing

   echo
   find "$fdir" -type f -name "${fnam}-*.png"
   echo
   find "$fdir" -type f -name "${fnam}-*.png" -print0 |
     awk -F'[-.]' '{print $(NF-1), $0}' RS='\0' ORS='\0' |
     sort -nk 1,1 | cut -d ' ' -f2-
   echo

I also had a go with ORS='\n'

Output:

/home/flora/edvart/docs/schimmel-04.png
/home/flora/edvart/docs/schimmel-05.png
/home/flora/edvart/docs/schimmel-06.png
/home/flora/edvart/docs/schimmel-07.png
/home/flora/edvart/docs/schimmel-08.png
/home/flora/edvart/docs/schimmel-09.png
/home/flora/edvart/docs/schimmel-10.png
/home/flora/edvart/docs/schimmel-11.png
/home/flora/edvart/docs/schimmel-12.png
/home/flora/edvart/docs/schimmel-13.png
/home/flora/edvart/docs/schimmel-1.png
/home/flora/edvart/docs/schimmel-2.png
/home/flora/edvart/docs/schimmel-3.png

/home/flora/edvart/docs/schimmel-04.png

The printing stops at the first file entry.







reply via email to

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