help-bash
[Top][All Lists]
Advanced

[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:56:17 +0200

On Mon, Oct 18, 2021 at 06:31:21AM +0000, tolugboji wrote:
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> 
> On Monday, October 18th, 2021 at 6:18 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: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-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}'
> > >
> > > The command gives only one entry, the following
> > >
> > > 04 /home/flora/edvart/docs/schimmel-04.png
> >
> > What does this give?
> >
> > find "$fdir" -type f -name "-.png"
> >
> > -----------------------------------------------------------
> >
> >     Chris F.A. Johnson
> >
> 
> I am beginning to suspect it is related to the installation of
> mawk 1.3.3 Nov 1996
> 
> Quite strange how the following command gives nothing!
> 
> find "$fdir" -type f -name ".png"

Stop and think for a while. What would you expect that the above command
does?  Do you have any file called exactly ".png"?

I'm noticing that the the command further up in the thread now says
"-.png" even though it used to have asterisks around the dash.  Your
Protonmail reader probably changed that into a bold dash for your
convinience.

Now could we get to know how this is related to the bash shell other
than that this happens to be the shell that you are running?  It's a
mildly interesting issue, but it's off-topic here.  There are tools with
native capabilities to deal with exactly what it is you are trying to
do, but you seem to be blind on that eye.



-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

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