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