3 sort \- sort and/or merge files
44 together and writes the result on
46 If no input files are named, the standard input is sorted.
48 The default sort key is an entire line.
50 lexicographic by runes.
51 The ordering is affected globally by the following options,
52 one or more of which may appear.
57 non-white space characters
72 Ignore leading white space (spaces and tabs) in field comparisons.
75 `Phone directory' order:
78 digits and white space
79 are significant in comparisons.
83 letters onto upper case.
84 Accented characters are folded to their
85 non-accented upper case form.
88 Ignore characters outside the
91 in non-numeric comparisons.
96 but ignore only tabs and spaces.
99 An initial numeric string,
100 consisting of optional white space,
101 optional plus or minus sign,
102 and zero or more digits with optional decimal point,
103 is sorted by arithmetic value.
110 exponents, are sorted by value.
113 Reverse the sense of comparisons.
116 `Tab character' separating fields is
120 .BI + "pos1\| " - pos2\^
121 restricts a sort key to a field beginning at
123 and ending just before
130 optionally followed by one or more of the flags
134 tells a number of fields to skip from the beginning of the line and
136 tells a number of characters to skip further.
137 If any flags are present they override all the global
138 ordering options for this key.
145 means the end of the line.
148 option, fields are strings separated by
151 non-empty strings separated by white space.
152 White space before a field
153 is part of the field, except under option
157 flag may be attached independently to
171 have the same format but different meanings.
174 is origin 1 instead of origin 0
179 is the end of the field.
181 When there are multiple sort keys, later keys
182 are compared only after all earlier keys
184 Lines that otherwise compare equal are ordered
185 with all bytes significant.
187 These option arguments are also understood:
188 .TP \w'\fL-z\fIrecsize\fLXX'u
190 Check that the single input file is sorted according to the ordering rules;
191 give no output unless the file is out of sort.
194 Merge; assume the input files are already sorted.
197 Suppress all but one in each
200 and bytes outside keys
201 do not participate in
205 The next argument is the name of an output file
206 to use instead of the standard output.
207 This file may be the same as one of the inputs.
210 Put temporary files in
217 .L sort -u +0f +0 list
218 Print in alphabetical order all the unique spellings
220 where capitalized words differ from uncapitalized.
222 .L sort -t: +1 /adm/users
225 (the second colon-separated field).
228 Print the first instance of each month in an already sorted file.
231 with just one input file make the choice of a
232 unique representative from a set of equal lines predictable.
235 grep -n '^' input | sort -t: +1f +0n | sed 's/[0-9]*://'
236 A stable sort: input lines that compare equal will
237 come out in their original order.
239 .BI /tmp/sort. <pid>.<ordinal>
241 .B /usr/local/plan9/src/cmd/sort.c
247 comments and exits with non-null status for various trouble
248 conditions and for disorder discovered under option
251 An external null character can be confused
252 with an internally generated end-of-field character.
253 The result can make a sub-field not sort
254 less than a longer field.
256 Some of the options, e.g.
260 are hopelessly provincial.