unix - Forcing the order of output fields from cut command -


I have to do something like this:

  cat abcd.txt | Cut-F2.1  

and I should be in order 2 and then 1 in output. I'm doing the test (Free BSD 6) on the machine, it is not happening (printing it in 1,2 order). Can you tell me how to do this?

I know that I can always write a shell script to back it up, but I'm looking for something using the 'cut' command options.

> I think I'm using version 5.2.1 of the cut-off coriulti.

This can not be done using the Cut according to the man page:

Selected input is written in one order, which is read, and written once. Instead, you can use it by using awk , such as:

  awk '{print ($ 2, "/>  \ T ", $ 1)} 'abcd.txt  

Change whatever you are using as a field separator.


Comments