Using awk to switch columns
I have a file of the following form:
001 002
001 003
001 004
001 003
002 001
002 004
002 004
002 005
... ...
Which has already been sorted once. However, the column position is trivial as in 001 002 is the same as 002 001, so what I want to do is go down each line and if the number in the second column is smaller than the number in the first column, I want them to switch positions. Is this possible?
|