36.3 Changing the Field DelimiterArticle 36.2 explained how sort separates a line of input into two or more fields using "white space" (spaces or tabs) as field delimiters. The -t option lets you change the field delimiter to some other character. For example, if you wanted to sort the login names on your system by the login shell they use, you could issue a command like this:
The option -t: tells sort to use a colon as a field separator - so, in this example, field 0 is the login name, field 1 is the encoded password, field 2 is the user ID number, field 3 is the group ID number, and so on. By this numbering, the login shell is in the sixth field. Remember that sort numbers fields starting with zero - this will save you lots of grief. Two consecutive colons indicate a "null" field that still must be counted. - , |
|