On Sun, Nov 1, 2020 at 9:10 PM David Čepelík <[email protected]> wrote:
> 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.

Yes, following gawk is likely to be most useful for the users.
Please send the patch.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to