SORT(I) 6/11/74 SORT(I)
sort - sort or merge files
sort [ -abdnrtx ] [ +pos [
-pos ] ] . . . [ -mo ] [ name ]
. . .
Sort sorts all the named files together and writes the
result on the standard output. The name `-' means the
standard input. The standard input is also used if no input
file names are given. Thus sort may be used as a filter.
The default sort key is an entire line. Default ordering is
lexicographic in ASCII collating sequence, except that
lower-case letters are considered the same as the
corresponding upper-case letters. Non-ASCII bytes are
ignored. The ordering is affected by the flags abdnrt, one
or more of which may appear:
a Do not map lower case letters.
b Leading blanks (spaces and tabs) are not included in
d `Dictionary' order: only letters, digits and blanks are
significant in ASCII comparisons.
n An initial numeric string, consisting of optional minus
sign, digits and optionally included decimal point, is
sorted by arithmetic value.
r Reverse the sense of comparisons.
tx Tab character between fields is x.
Selected parts of the line, specified by +pos and -pos, may
be used as sort keys. Pos has the form m.n, where m
specifies a number of fields to skip, and n a number of
characters to skip further into the next field. A missing
.n is taken to be 0. +pos denotes the beginning of the key;
-pos denotes the first position after the key (end of line
by default). The ordering rule may be overridden for a
particular key by appending one or more of the flags abdnr
When no tab character has been specified, a field consists
of nonblanks and any preceding blanks. Under the -b flag,
leading blanks are excluded from a field. When a tab
character has been specified, a field is a string ending
with a tab character.
When keys are specified, later keys are compared only when
all earlier ones compare equal. Lines that compare equal
are ordered with all bytes significant.
These flag arguments are also understood:
-m Merge only, the input files are already sorted.
-o The next argument is the name of an output file to use
instead of the standard output. This file may be the
same as one of the inputs, except under the merge flag