James KEEFER wrote:
> As far as I can see, there is no way to re-order fields using cut.
That is correct. But other tools do this easily.
> It would be nice to be able to specify -f 3,2,1 and have the first
> three fields switched in their order. It would also be nice to
> repeat an input fields in the output, such as -f 1,1,1 repeating the
> first field three times.
I suggest using awk for this. It is a standard tool that will do
exactly what you are asking.
$ echo one two three four | awk '{print $3,$1,$2}'
three one two
$ echo one two three four | awk '{print $3,$2,$1,$2}'
three two one two
Using awk just seems perfectly fitted to these types of tasks.
Bob
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils