On Wed, Aug 29, 2012 at 10:43 AM, Rajagopal Swaminathan raju.rajsand@gmail.com 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.