How to exchange two columns in a table?
samuel.thibault at ens-lyon.org
Mon Jan 8 18:50:56 UTC 2007
Tim Chase, le Mon 08 Jan 2007 12:42:11 -0600, a écrit :
> >You can use cut for this:
> >cut -d " " -f 1-3,5,4,6-8
> >(the character between the two " is a tab, which you can type by
> >pressing ^V then the tab. Here columns 3 and 4 are exchanged.
> It would be really nice if "cut" did this. However, cut doesn't
> emit the fields in the requested order, but rather (from the man
> page) "The order of ... fields in the output will be identical
> to those in the input".
Gasssp. I thought it was the case. Thanks for the info!
> Additionally, if you want to be lazy, the delimiter for "cut"
> defaults to a tab, so you don't have to specify it unless you use
> a different delimiter such as a colon.
I can never remember this, so always specify it :)
More information about the Blinux-list