SORT(I) 5/13/75 SORT(I)
NAME
sort, usort - sort or merge files
SYNOPSIS
sort [ -abdnrtx ] [ +pos [ -pos ] ] . . . [ -mo ] [ name ]
. . .
usort [ -umo ] [ name ] . . .
DESCRIPTION
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
fields.
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
to +pos.
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
-m.
Usort is a somewhat specialized version of sort which
accepts no collating sequence options: order is always plain
ASCII. It also strips out the second and following copies
of duplicated lines. A u flag prevents this stripping.
Usort also understands the m and o options in the same way
as sort.
FILES
/usr/tmp/stm???
BUGS