Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

sort(1) OSS Shell and Utilities Reference Manual
The fskip variable species the number of elds to skip from the beginning of the input
line, and the cskip variable species the number of additional characters to skip to the
right beyond that point. For both the starting point (+fskip.cskip) and the ending point
(-fskip.cskip) of a sort key, fskip is measured from the beginning of the input line, and
cskip is measured from the last eld skipped. If you omit .cskip, .0 (zero) is assumed.
If you omit fskip, 0 (zero) is assumed. If you omit the ending eld specier
(-fskip.cskip), the end of the line is the end of the sort key.
You can supply more than one sort key by repeating +fskip.cskip and -fskip.cskip.In
cases where you specify more than one sort key, keys specied further to the right on
the command line are compared only after all earlier keys are sorted. For example, if
the rst key is to be sorted in numerical order and the second according to the collating
sequence, all strings that start with the number 1 are sorted according to the collating
order before the strings that start with the number 2. Lines that are identical in all keys
are sorted with all characters signicant. You can also specify different ags for
different sort keys in multiple sort keys.
-fskip.cskip
Species the end position of a key eld. See the -k ag for a description of the current
way to perform this operation. (Obsolescent)
DESCRIPTION
The sort command performs one of the following functions:
1. Sorts lines of all the named les together and writes the result to the specied output.
2. Merges lines of all the named (presorted) les together and writes the result to the
specied output.
3. Checks that a single input le is correctly presorted.
Comparisons are based on one or more sort keys extracted from each line of input (or the entire
line if no sort keys are specied), and are performed using the collating sequence of the current
locale.
The sort command treats all of its input les as one le when it performs the sort. A - (dash) in
place of a lename species standard input. If you do not specify a lename, it sorts standard
input.
The sort command can handle a variety of collation rules typically used in Western European
languages, including primary/secondary sorting, one-to-two character mapping, N-to-one charac-
ter mapping, and ignore-character mapping. To summarize briey:
Primary/Secondary Sorting
In this system, a group of characters all sort to the same primary location. If there is a tie, a
secondary sort is applied. For example, in French, the plain and accented as all sort to the same
primary location. If two strings collate to the same primary location, the secondary sort goes into
effect. These words are in correct French order:
à
abord
âpre
après
âpreté
azur
One-to-Two Character Mappings
This system requires that certain single characters be treated as if they were two characters. For
846 Hewlett-Packard Company 527188-004