Hello BusyBox developers,

I've noticed an interesting discrepancy between gawk and BusyBox awk:
when the FS is set to e.g. ` *` (space asterisk), gawk will not consider
empty matches of the regular expression (see e.g. [1]) while BusyBox
will. This example demonstrates it:

~% gawk --version
GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.0)
[...]
~% echo 'foo bar' | gawk -F' *' '{print $1}'
foo

While BusyBox (a7c065354) will produce:

1! ~/sw/3rd/busybox:master% echo 'foo bar' | ./busybox awk -F' *'  '{print $1}'
f

Is this desired behavior? To my best knowledge, this isn't standardized.
Would it make sense to harmonize BusyBox's implementation with GNU Awk?

This caused a problem in a 3rd-party script I was using and which
stopped working after being migrated to Alpine Linux.

Please let me know if I can provide further details. I'm happy to
provide a patch if that's the desired solution.

                                           Regards
                                           David

[1] 
https://stackoverflow.com/questions/22044272/gawk-fs-to-split-record-into-individual-characters
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to