[Toybox] Has anybody ever actually used cut -f?

Bastian Bittorf bb at npl.de
Sun Sep 4 11:23:02 PDT 2016


* Rob Landley <rob at landley.net> [04.09.2016 20:05]:
> > set -- one two three four five; echo $2 $3 $4
> >
> > i has two downsides:
> > 1) it's not intuitive
> > 2) it overwrites the ARGS
> 
> 3) It's processing command line arguments instead of lines from stdin,
> so is not actually performing an analogous function without adding
> "xargs" and a shell loop.

maybe this fits?:
set -- $( your_command ); echo $2 $3 $4

the other thing will be:
your_command | while read _ A B C _;do echo $A $B $C; done | next_command

but really, this does not look good compared to:
your_command | awk '{print $1" "$2 }' | next_command

or even (the non-posix):
your_command | cut -f2,3 | next_command

bye, bastian



More information about the Toybox mailing list