SortFileBySecondColumn

How to sort a file by its second column

This is going to be short, sweet and to the point:

You have a file a bit like this one:

llmmqpooi ADE some_info some_info some_info
kjkuijjkj AAA some_info some_info some_info
jioioduad ABC some_info some_info some_info

Only problem is: you want it sorted according to the second column... How to do that? Sort to the rescue:

$ sort +1 -2 file_name >> file_name.SORTED

And if you now look into the *.SORTED file, here is what you will get:

kjkuijjkj AAA some_info some_info some_info
jioioduad ABC some_info some_info some_info
llmmqpooi ADE some_info some_info some_info

This is, of course, a very very very short example of what sort can do for you...

See Also: