0

I have a file with as below:

A,B
1,hi there
2, Heloo there

I am trying to print the B column first and then column A

cat file.txt | cut -d "," -f2,1

However, this does not work. Any ideas how to do it?

fedorqui
  • 275,237
  • 103
  • 548
  • 598
user80040
  • 173
  • 1
  • 2
  • 5
  • possible duplicate of [Rearrange columns using cut](http://stackoverflow.com/questions/2129123/rearrange-columns-using-cut). Just use `awk` instead --> `awk 'BEGIN {FS=OFS=","} {print $2, $1}' file` – fedorqui Nov 11 '14 at 13:42
  • yup..thanks mate..was checking if it can be resolverd with cut as I am having issues with awk..it outputs with non bailable error :( – user80040 Nov 11 '14 at 13:50

0 Answers0