O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required