What is the difference between gawk and mawk with regards to field separators? In particular, I'm trying to figure out what is going on here:
mawk:
$ echo "100+50°20.5" | mawk -F '[+°.]' '{ print $1" - "$2" - "$3" - "$4" - "$5; }'
100 - 50 - - 20 - 5
gawk:
$ echo "100+50°20.5" | gawk -F '[+°.]' '{ print $1" - "$2" - "$3" - "$4" - "$5; }'
100 - 50 - 20 - 5 -
It looks like mawk is introducing an extra field somehow. What is the correct behavior?
-b
(--characters-as-bytes
) switch of the GNU awk or passLC_ALL=C gawk
orLC_ALL=C mawk
for the same result; see also Locales- Where You Are Makes A Difference°
is a multi-byte character.°
is multi-byte in UTF-8. (I remember the days when people could be using all sorts of character encodings, and you couldn't make any assumptions at all! Things are much better now that UTF-8 is the default, but it's not yet universal.)