On 15/01/2022 08:44, Shehu Dikko wrote:
* Rob Landley [2022-01-05] [gmane.comp.gnu.coreutils.general]:
Around 5 years ago toybox added the -D, -F, and -O options to cut:
-D Don't sort/collate selections or match -fF lines without delimiter
-F Select fields separated by DELIM regex
-O Output delimiter (default one space for -F, input delim for -f)
This lets you do:
$ echo one two three four five six seven eight nine | cut -DF 7,1-3,2
seven one two three two
Nice to see that one can specify a range of fields which is not
something that is as straigtforward with awk. I have also seen that it's
undocumented but one can also do the even more useful:
$ echo one two three four five six seven eight nine | cut -DF 1,5-$
one five six seven eight nine
Do please also add the undocumented feature to cut.
For now, it's alias cut='toybox cut'
Open ended ranges are already supported by coreutils cut:
$ echo one two three four five six seven eight nine | cut -d ' ' -f 1,5-
one five six seven eight nine
I don't think we need to support an explicit '$' for this.
cheers,
Pádraig