as someone (the maintainer of the Android command line tools) who has to
deal with Unix n00bs *a lot*, i think the sales pitch for this is really
"this makes cut able to do what new users assume cut is for (but can't)".

(they also are very unlikely to have even heard of awk, and realistically
go straight from "cut's broken" to "i'll use python then".)

On Sat, Dec 4, 2021 at 7:08 AM shwaresyst via austin-group-l at The Open
Group <austin-group-l@opengroup.org> wrote:

> Yes, there's a path; file an Enhancement Request in Mantis. However, if
> toybox wants to be more POSIX conforming it'll have to add an awk
> implementation anyways, eventually, so not sure such a request would get
> much traction for sponsorship. Those with awk already might not want to add
> it to their version of cut, as unnecessary duplication of functionality.
>
> On Sat, Dec 4, 2021 at 9:37 AM, Rob Landley via austin-group-l at The Open
> Group
> <austin-group-l@opengroup.org> wrote:
> Since toybox doesn't have its own awk yet (and thus awk '{print $3 $4
> $5}'),
> back in 2017 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)
>
> -O is -d for output, -F is a regex version of -f, and -D says to show the
> raw
> matches in the order requested (and ONLY those matches, not passing through
> lines with no matches).
>
> 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
>
> Elliott Hughes (the Android base OS maintainer) asked if I could get the
> feature
> more widely adopted:
>
>
> http://lists.landley.net/pipermail/toybox-landley.net/2021-June/012453.html
>
> > your non-POSIX cut(1) extension covers 80% of the in-the-wild use of awk
> > anyway :-) if you still talk to any of the busybox folks, we should
> suggest
> > they copy that --- it would be nice for it to be a de facto standard so
> we
> > can get it into POSIX sometime around the 2040s... (and have made lives
> > better for the folks who don't care about standards and just want to "get
> > things done" in the intervening decades!)
>
> So I offered to implement it in busybox:
>
>   http://lists.busybox.net/pipermail/busybox/2021-June/088886.html
>
> And the busybox maintainer merged it here:
>
>   https://git.busybox.net/busybox/commit/?id=0068ce2fa0e3
>
> Is there a path to try to get this option set into posix?
>
> Rob
>
>
  • cut -DF Rob Landley via austin-group-l at The Open Group
    • Re: cut -DF shwaresyst via austin-group-l at The Open Group
      • Re: cut -DF enh via austin-group-l at The Open Group

Reply via email to