[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: -F fs_val handles backslash-newline differently, compared to -v FS=v
From: |
arnold |
Subject: |
Re: -F fs_val handles backslash-newline differently, compared to -v FS=val and FS=val |
Date: |
Thu, 08 Jun 2023 22:34:44 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Hi Neil.
The quoting in the csh and in the Bourne shell are different;
this is even mentioned in the gawk manual. If you use a Bourne-type
shell you'll see the issue, which is real.
Thanks,
Arnold
"Neil R. Ormos" <ormos-gnulists17@ormos.org> wrote:
> Denys Vlasenko wrote:
>
> > GNU awk 5.1.1
>
> > gawk -F '\
> > a' 'BEGIN { print "FS1=" FS }'
>
> > gawk -v FS='\
> > a' 'BEGIN { print "FS2=" FS }'
>
> > echo | gawk '{ print "FS3=" FS }' FS='\
> > a'
>
> > The first command treats "backslash+newline" as backslash:
>
> > FS1=\a
>
> > The second and third commands treat the same as empty string:
>
> > FS2=a
> > FS3=a
>
> > I think it would be better if all forms have the same rules.
>
> I was unable to reproduce the reported behavior using any of Gawk versions
> 4.1.4, 5.1.1, and 5.2.0 and the tcsh shell.
>
> When I tested, in the first two commands, FS1 and FS2 contained the
> characters $0A $61. In the third command, FS3 contained a single blank.
>
> I did not test using any other shells.
>
>
>