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 10:43 AM, Rajagopal Swaminathan
<raju.rajsand@xxxxxxxxx> wrote:
>
> But the cut command in Linux behaves differently.
>
> >From the man page:
> Quote:
> Selected input is written in the same order that it is read, and is
> written exactly once.
>
> Which I think is poor. I can't see any way to do what you want with cut.
>
> [unquote]

If you are willing to use tmp files you can:
cut -d, -f1 <input >tmp1
cut -d, -f2 <input >tmp2
cut -d, -f3 <input >tmp3

paste -d, tmp1 tmp3 tmp2 >file_I_wanted
rm tmp1 tmp2 tmp3

There's probably a clever way to do this with tee and fifos to handle
unlimited stream sizes but I'm too lazy to work it out.

-- 
   Les Mikesell
     lesmikesell@xxxxxxxxx
_______________________________________________
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