[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: null record separator prints only one file
From: |
Andreas Kusalananda Kähäri |
Subject: |
Re: null record separator prints only one file |
Date: |
Mon, 18 Oct 2021 08:25:03 +0200 |
On Mon, Oct 18, 2021 at 06:02:19AM +0000, tolugboji wrote:
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Monday, October 18th, 2021 at 5:55 AM, Chris F.A. Johnson
> <chris@cfajohnson.com> wrote:
>
> > On Mon, 18 Oct 2021, tolugboji wrote:
> >
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > >
> > > On Monday, October 18th, 2021 at 5:42 AM, Chris F.A. Johnson
> > > chris@cfajohnson.com wrote:
> > >
> > > > On Mon, 18 Oct 2021, tolugboji via wrote:
> > > >
> > > > > I am using the following command with null record separators for a
> > > > > set of png files, and cannot
> > > > >
> > > > > figure out why only one png file is being printed.
> > > > >
> > > > > find "$fdir" -type f -name "${fnam}-*.png" -print0 | awk -v RS='\0'
> > > > > -F'[-.]' '{print $(NF-1), $0}' | cat -vet
> > > >
> > > > How many files does this find:
> > > >
> > > > find "$fdir" -type f -name "${fnam}-*.png"
> > > >
> > > > Chris F.A. Johnson
> > > >
> > >
> > > It finds 13 files, namely
> > >
> > > /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
> >
> > And how many does this print:
> >
> > find "$fdir" -type f -name "${fnam}-*.png" -print0 | awk -v RS='\0'
> > -F'[-.]' '{print $(NF-1), $0}'
> >
> > ------------------------------------------------------------------------------------------------------------------------------------
> >
> > Chris F.A. Johnson
> >
>
> The command gives only one entry, the following
>
> 04 /home/flora/edvart/docs/schimmel-04.png
>
>
Did you ever try the zsh solution that another user gave you to your
original question (https://unix.stackexchange.com/q/673509/116858)? It
seems to me that using a single utility that has the filename globbing
capabilities that you require seems more reasonable than using a
pipeline of text manipulation tools.
In any case, this has since a while no longer been a bash-related issue.
Your awk issue here is due to your specific awk (probably busybox awk)
not implementing the same extensions to standard awk as GNU awk or mawk
does.
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.
- null record separator prints only one file, tolugboji, 2021/10/18
- Re: null record separator prints only one file, Chris F.A. Johnson, 2021/10/18
- null record separator prints only one file, tolugboji, 2021/10/18
- Re: null record separator prints only one file, Chris F.A. Johnson, 2021/10/18
- null record separator prints only one file, tolugboji, 2021/10/18
- Re: null record separator prints only one file, Chris F.A. Johnson, 2021/10/18
- null record separator prints only one file, tolugboji, 2021/10/18
- Re: null record separator prints only one file, Chris F.A. Johnson, 2021/10/18
- Re: null record separator prints only one file, Andreas Kusalananda Kähäri, 2021/10/18
- Re: null record separator prints only one file, Greg Wooledge, 2021/10/18
- Re: null record separator prints only one file,
Andreas Kusalananda Kähäri <=