bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] FPAT bug?


From: Andrew J. Schorr
Subject: Re: [bug-gawk] FPAT bug?
Date: Sat, 1 Apr 2017 13:08:48 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Apr 01, 2017 at 10:28:47AM -0500, Ed Morton wrote:
> OK, thanks for the update!

Just to confirm that this is a bug: I think the results must be
consistent with the patsplit function. In 4.1.4, it says:

bash-4.2$ ./gawk 'BEGIN {nf = patsplit(",,3", f, "[^,]*"); for (i = 1; i <= nf; 
i++) printf "%d [%s]\n", i, f[i]}'
1 []
2 []
3 [3]

That is clearly inconsistent with:

bash-4.2$ (echo ,,3; echo ,,3) | ./gawk -v "FPAT=[^,]*" '{for (i = 1; i <= NF; 
i++) printf "%d [%s]\n", i, $i}'
1 []
2 []
3 [3]
1 []
2 [3]

So 4.1.4 is internally inconsistent; the first record was parsed correctly, but
the second was not.  The only remaining question is how to fix this properly...

Regards,
Andy



reply via email to

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