11.1. Using sort

The sort command enables you to sort on many different fields (sort keys) in different column orders. You’ll find sort will come in very handy when going over log files, or rearranging the text columns for downloaded files for another user. In fact, when you use other UNIX tools it assumes the files to be worked on have been previously sorted. Anyway, it makes more sense to have a file sorted than unsorted.

11.1.1. A word to the wise

The sort utility that comes with UNIX/LINUX is very powerful, though care has to be taken when using different combinations of the sort options as they can lead to unexpected results. The options for sort are very long, and even I have trouble sometimes working out what the different switches actually ...

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.