User's manual. Section 1.

SRT(1): sort lines


USAGE

DESCRIPTION

Srt sorts files using as keys the ones indicated to the -r flag, in the order in which they were specified. This can be used to sort each input file on its own and to sort output from gx or related commands.

A key is indicated by giving, in this order:

A range may be a single line number, counting from 1, or a pair of start and end field numbers separated by a "," character. Negative field numbers count backwards from the end of the line (the last is -1 and so on). A missing start number in a range means 1, and a missing end number in a range means -1. If no range is given, "," is implied. And, when such range is indicated, all fields are printed, one line at a time.

The format may be one of:

The reverse indicator is "r", causing a sort in reverse order.

By default the field separator is a run of blanks. Flag -F changes the set of runes used as field separators to its argument.

Flag -1 indicates that fields are separated exactly by one instance of the separator string. Such string defaults to a tabulator character in this case, unless -F says otherwise.

EXAMPLES

Sort in ascending string order:

Sort in reverse numeric order (all fields):

Sort all files in the current directory and write them back sorted:

Sort the second and third fields in ascending numeric order and the last field in reverse string order, for a file separated with a ":" character, honoring empty fields:

SOURCE


User's manual. Section 1.