Re: Cut command behaviour - bug or feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux