[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: |
Neil R. Ormos |
Subject: |
Re: -F fs_val handles backslash-newline differently, compared to -v FS=val and FS=val |
Date: |
Thu, 8 Jun 2023 10:49:02 -0500 (CDT) |
User-agent: |
Alpine 2.20 (DEB 67 2015-01-07) |
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.