3 sort \- sort and/or merge files
46 together and writes the result on
48 If no input files are named, the standard input is sorted.
50 The default sort key is an entire line.
52 lexicographic by runes.
53 The ordering is affected globally by the following options,
54 one or more of which may appear.
59 non-white space characters
74 Ignore leading white space (spaces and tabs) in field comparisons.
77 `Phone directory' order:
80 digits and white space
81 are significant in comparisons.
85 letters onto upper case.
86 Accented characters are folded to their
87 non-accented upper case form.
90 Ignore characters outside the
93 in non-numeric comparisons.
98 but ignore only tabs and spaces.
101 An initial numeric string,
102 consisting of optional white space,
103 optional plus or minus sign,
104 and zero or more digits with optional decimal point,
105 is sorted by arithmetic value.
112 exponents, are sorted by value.
115 Reverse the sense of comparisons.
118 `Tab character' separating fields is
122 .BI + "pos1\| " - pos2\^
123 restricts a sort key to a field beginning at
125 and ending just before
132 optionally followed by one or more of the flags
136 tells a number of fields to skip from the beginning of the line and
138 tells a number of characters to skip further.
139 If any flags are present they override all the global
140 ordering options for this key.
147 means the end of the line.
150 option, fields are strings separated by
153 non-empty strings separated by white space.
154 White space before a field
155 is part of the field, except under option
159 flag may be attached independently to
173 have the same format but different meanings.
176 is origin 1 instead of origin 0
181 is the end of the field.
183 When there are multiple sort keys, later keys
184 are compared only after all earlier keys
186 Lines that otherwise compare equal are ordered
187 with all bytes significant.
189 These option arguments are also understood:
190 .TP \w'\fL-z\fIrecsize\fLXX'u
192 Check that the single input file is sorted according to the ordering rules;
193 give no output unless the file is out of sort.
196 Merge; assume the input files are already sorted.
199 Suppress all but one in each
202 and bytes outside keys
203 do not participate in
207 The next argument is the name of an output file
208 to use instead of the standard output.
209 This file may be the same as one of the inputs.
212 Put temporary files in
219 .L sort -u +0f +0 list
220 Print in alphabetical order all the unique spellings
222 where capitalized words differ from uncapitalized.
224 .L sort -t: +1 /adm/users
227 (the second colon-separated field).
230 Print the first instance of each month in an already sorted file.
233 with just one input file make the choice of a
234 unique representative from a set of equal lines predictable.
237 grep -n '^' input | sort -t: +1f +0n | sed 's/[0-9]*://'
238 A stable sort: input lines that compare equal will
239 come out in their original order.
241 .BI /tmp/sort. <pid>.<ordinal>
243 .B /sys/src/cmd/sort.c
249 comments and exits with non-null status for various trouble
250 conditions and for disorder discovered under option
253 An external null character can be confused
254 with an internally generated end-of-field character.
255 The result can make a sub-field not sort
256 less than a longer field.
258 Some of the options, e.g.
262 are hopelessly provincial.