why does "cut" print fields in original order?

Les Mikesell lesmikesell at gmail.com
Wed Nov 21 20:55:16 UTC 2007

Tony Nelson wrote:

>> yes, i now appreciate that cut's behaviour is the very efficient
>> technique of treating the data as a one-way stream, so i'm good with
>> that.  so lay off already.  ya hear me??  LAY OFF!!!
>  ...
> This all rather begs the question of what tool to use after cut in order to
> reorder the fields?  Don't pretend the answer is sed or awk, or their ilk.

If you'd rather pretend that more suitable tools don't exist, cut each 
field you want into its own file, then use paste to glue them back in 
the order you want.  Be careful to use suitable tmp names so concurrent 
runs don't break.

   Les Mikesell
    lesmikesell at gmail.com

More information about the users mailing list