[CentOS] Cut command behaviour - bug or feature
Stephen Harris
lists at spuddy.org
Tue Aug 28 21:52:26 UTC 2012
On Wed, Aug 29, 2012 at 01:29:05AM +0530, Rajagopal Swaminathan wrote:
> a1,b1,c1
> a2,b2,c2
> cut -d, -f2,3,1 <file>
Will not work. The "-f" flag specifies what columns; not the order.
Everyone makes that mistake once :-)
> In that case how do I go about swapping two columns? I do not think a
> gazzillion byte gui is required.
Use "awk"
awk -F, '{print $2 "," $3 "," $1}'
--
rgds
Stephen
More information about the CentOS
mailing list