swapping two columns with awk keeping tabulation

Assuming you have a data file with N columns and you want to swap the first and second one, just type:

To keep the tabulation intact, you need to specify the separator.

Incoming separator is defined by -F $’\t’ and the separator for the output is defined by OFS=$’\t’.

This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.