Contents:
Putting Things in Order 
Sort Fields: How sort Sorts 
Changing the Field Delimiter 
Confusion with White Space Field Delimiters 
Alphabetic and Numeric Sorting 
Miscellaneous sort Hints 
Sorting Multiline Entries 
lensort: Sort Lines by Length 
Sorting a List of People by Last Name 
Sorting a file under UNIX is easy, right? Of course it is, if all you want to do is sort a list of single words, or sort lines starting with the first character in the line. But if you want to do more than that, there's a lot more to the sort command than typing:
%sortfilename
Article 36.2 describes how to select individual fields from a line for sort to operate on.
Article 36.3 describes how to change the field delimiter from "white space" to some other character.
Article 36.4 describes the kinds of problems that you can encounter if fields are delimited by white space.
Article 36.5 clarifies the distinctions between alphabetic and numeric sorting.
Article 36.6 gives miscellaneous hints about useful sort options.
But learning the mechanics of sort isn't the end of the story. Like most of the other things you'll find in the UNIX toolbox, sort is even more powerful when it's used with other programs. For example, you can:
Sort paragraphs, or other multiline entries (article 36.7).
Sort lines by how long they are (article 36.8).
Sort a list of names by last name, whether or not there's a middle name as well (article 36.9).
-