| Summary: | awk NF corrupt when using FS regex and + (matching one or more of preceding expression) | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Mavik <mavik> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
Fixed in git: commit 5323af7f51808d5ff35c624ba70bdae4807f3717 Author: Denys Vlasenko <vda.linux@googlemail.com> Date: Mon Nov 16 10:40:32 2020 +0100 awk: fix dodgy multi-char separators splitting logic |
I think that in all the following cases the value of `$NF` should be the empty string as is output by gawk (see below). {{{ # printf "a==123=" | awk -F '=+' '{print $NF}' = # printf "a===123=" | awk -F '=+' '{print $NF}' 3= # printf "a====123=" | awk -F '=+' '{print $NF}' 23= # printf "a=====123=" | awk -F '=+' '{print $NF}' 123= }}} This is the output from gawk: {{{ $ printf "a==123=" | awk -F '=+' '{print $NF}' $ printf "a===123=" | awk -F '=+' '{print $NF}' $ printf "a====123=" | awk -F '=+' '{print $NF}' $ printf "a=====123=" | awk -F '=+' '{print $NF}' }}}