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

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

On Sunday, October 17th, 2021 at 10:12 PM, tolugboji <tolugboji@protonmail.com> 
wrote:

> ‐‐‐‐‐‐‐ 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-

Have concatenated the piped lines on separate lines with \ to have

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





reply via email to

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