awk: FS regex matches only non-empty separators (gawk compat)

function                                             old     new   delta
awk_split                                            484     553     +69

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2020-12-02 19:07:31 +01:00
parent 50ead33c45
commit 665a659530
2 changed files with 32 additions and 8 deletions

View File

@@ -398,5 +398,12 @@ testing 'awk do not allow "str"++' \
'' \
'anything'
#gawk compat: FS regex matches only non-empty separators:
#with -*, the splitting is NOT f o o b a r, but foo bar:
testing 'awk FS regex which can match empty string' \
"awk -F '-*' '{print \$1 \"-\" \$2 \"=\" \$3 \"*\" \$4}'" \
"foo-bar=*\n" \
'' \
'foo--bar'
exit $FAILCOUNT