MPE/iX Shell and Utilities Reference Manual, Vol 2

sort(1) MPE/iX Shell and Utilities sort(1)
which when preceded with +m[.n] is equivalent to
–k m+1[.n+1],p.0[options] if q is specified and is zero
or
–k m+1[.n+1],p+1[.q][options] otherwise.
For example,
+1.2 -3.5
defines a sorting key with a starting position that sort finds by skipping the first field and
then the first 2 characters of the next field and an ending position that sort finds by skipping
the first three fields and then the first five characters of the next field. In other words the sort-
ing key extends from the third character of the second field to the sixth character of the fourth
field. This is the same key as defined under the –k option described earlier.
With either syntax, if the end of a sorting key is not a valid position after the beginning key
position, the sorting key extends to the end of the input record.
You can specify multiple sort key positions by using several –k options or several + and op-
tions. In this case, sort uses the second sorting key only for records where the first sorting
keys are equal, the third sorting key only when the first two are equal, and so on. If all key po-
sitions compare equal, sort determines ordering by using the entire record.
When you specify the –u option to determine the uniqueness of output records, sort only
looks at the sorting keys, not the whole record. (Of course, if you specify no sorting keys,
sort considers the whole record to be the sorting key.)
EXAMPLES
To sort an input file having lines consisting of the day of the month, white space, and the
month, as in:
30 December
23 MAY
25 June
10 June
use the command:
sort -k 2M -k 1n
To merge two dictionaries, with one word per line:
sort –m –dfi dict1 dict2 >newdict
1-562 Commands and Utilities