Annotation of src/usr.bin/sort/sort.1, Revision 1.53
1.53 ! millert 1: .\" $OpenBSD: sort.1,v 1.52 2015/04/05 13:54:06 millert Exp $
1.1 millert 2: .\"
3: .\" Copyright (c) 1991, 1993
4: .\" The Regents of the University of California. All rights reserved.
5: .\"
6: .\" This code is derived from software contributed to Berkeley by
7: .\" the Institute of Electrical and Electronics Engineers, Inc.
8: .\"
9: .\" Redistribution and use in source and binary forms, with or without
10: .\" modification, are permitted provided that the following conditions
11: .\" are met:
12: .\" 1. Redistributions of source code must retain the above copyright
13: .\" notice, this list of conditions and the following disclaimer.
14: .\" 2. Redistributions in binary form must reproduce the above copyright
15: .\" notice, this list of conditions and the following disclaimer in the
16: .\" documentation and/or other materials provided with the distribution.
1.20 millert 17: .\" 3. Neither the name of the University nor the names of its contributors
1.1 millert 18: .\" may be used to endorse or promote products derived from this software
19: .\" without specific prior written permission.
20: .\"
21: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: .\" SUCH DAMAGE.
32: .\"
33: .\" @(#)sort.1 8.1 (Berkeley) 6/6/93
34: .\"
1.53 ! millert 35: .Dd $Mdocdate: April 5 2015 $
1.1 millert 36: .Dt SORT 1
37: .Os
38: .Sh NAME
39: .Nm sort
1.41 millert 40: .Nd sort, merge, or sequence check text and binary files
1.1 millert 41: .Sh SYNOPSIS
42: .Nm sort
1.43 jmc 43: .Op Fl bCcdfgHhiMmnRrsuVz
1.42 jmc 44: .Op Fl k Ar field1 Ns Op , Ns Ar field2
1.23 jmc 45: .Op Fl o Ar output
1.42 jmc 46: .Op Fl S Ar size
1.1 millert 47: .Op Fl T Ar dir
1.23 jmc 48: .Op Fl t Ar char
1.34 sobrado 49: .Op Ar
1.1 millert 50: .Sh DESCRIPTION
51: The
1.8 aaron 52: .Nm
1.41 millert 53: utility sorts text and binary files by lines.
54: A line is a record separated from the subsequent record by a
55: newline (default) or NUL \'\\0\' character (-z option).
56: A record can contain any printable or unprintable characters.
57: Comparisons are based on one or more sort keys extracted from
58: each line of input, and are performed lexicographically,
59: according to the current locale's collating rules and the
60: specified command-line options that can tune the actual
61: sorting behavior.
1.8 aaron 62: By default, if keys are not given,
63: .Nm
1.41 millert 64: uses entire lines for comparison.
1.1 millert 65: .Pp
1.49 jmc 66: If no
67: .Ar file
68: is specified, or if
69: .Ar file
70: is
71: .Sq - ,
72: the standard input is used.
73: .Pp
1.7 aaron 74: The options are as follows:
1.21 jmc 75: .Bl -tag -width Ds
1.41 millert 76: .It Fl C, Fl Fl check=silent|quiet
1.35 schwarze 77: Check that the single input file is sorted.
78: If it is, exit 0; if it's not, exit 1.
79: In either case, produce no output.
1.41 millert 80: .It Fl c, Fl Fl check
1.35 schwarze 81: Like
82: .Fl C ,
1.37 jmc 83: but additionally write a message to
1.35 schwarze 84: .Em stderr
85: if the input file is not sorted.
1.41 millert 86: .It Fl m , Fl Fl merge
1.1 millert 87: Merge only; the input files are assumed to be pre-sorted.
1.41 millert 88: If they are not sorted, the output order is undefined.
89: .It Fl o Ar output , Fl Fl output Ns = Ns Ar output
90: Write the output to the
1.1 millert 91: .Ar output
1.41 millert 92: file instead of the standard output.
1.12 aaron 93: This file can be the same as one of the input files.
1.42 jmc 94: .It Fl S Ar size , Fl Fl buffer-size Ns = Ns Ar size
1.41 millert 95: Use a memory buffer no larger than
96: .Ar size .
97: The modifiers %, b, K, M, G, T, P, E, Z, and Y can be used.
98: If no memory limit is specified,
99: .Nm
100: may use up to about 90% of available memory.
101: If the input is too big to fit into the memory buffer,
102: temporary files are used.
1.42 jmc 103: .It Fl s
104: Stable sort; maintains the original record order of records that have
1.50 jmc 105: an equal key.
1.42 jmc 106: This is a non-standard feature, but it is widely accepted and used.
1.41 millert 107: .It Fl T Ar dir , Fl Fl temporary-directory Ns = Ns Ar dir
108: Store temporary files in the directory
109: .Ar dir .
110: The default path is the value of the environment variable
1.1 millert 111: .Ev TMPDIR
112: or
113: .Pa /var/tmp
114: if
115: .Ev TMPDIR
1.41 millert 116: is not defined.
117: .It Fl u , Fl Fl unique
1.12 aaron 118: Unique: suppress all but one in each set of lines having equal keys.
1.41 millert 119: This option implies a stable sort (see below).
120: If used with
1.35 schwarze 121: .Fl C
122: or
1.41 millert 123: .Fl c ,
124: .Nm
125: also checks that there are no lines with duplicate keys.
1.38 jmc 126: .El
127: .Pp
1.1 millert 128: The following options override the default ordering rules.
1.37 jmc 129: If ordering options appear before the first
130: .Fl k
131: option, they apply globally to all sort keys.
1.1 millert 132: When attached to a specific key (see
133: .Fl k ) ,
1.41 millert 134: the ordering options override all global ordering options for that key.
1.37 jmc 135: Note that the ordering options intended to apply globally should not
136: appear after
137: .Fl k
138: or results may be unexpected.
1.1 millert 139: .Bl -tag -width indent
1.41 millert 140: .It Fl d , Fl Fl dictionary-order
141: Consider only blank spaces and alphanumeric characters in comparisons.
142: .It Fl f , Fl Fl ignore-case
143: Consider all lowercase characters that have uppercase
1.12 aaron 144: equivalents to be the same for purposes of comparison.
1.41 millert 145: .It Fl g, Fl Fl general-numeric-sort, Fl Fl sort=general-numeric
146: Sort by general numerical value.
147: As opposed to
148: .Fl n ,
1.50 jmc 149: this option handles general floating points.
150: It has a more
151: permissive format than that allowed by
152: .Fl n
1.41 millert 153: but it has a significant performance drawback.
154: .It Fl h, Fl Fl human-numeric-sort, Fl Fl sort=human-numeric
155: Sort by numerical value, but take into account the SI suffix,
156: if present.
157: Sorts first by numeric sign (negative, zero, or
158: positive); then by SI suffix (either empty, or `k' or `K', or one
159: of `MGTPEZY', in that order); and finally by numeric value.
160: The SI suffix must immediately follow the number.
161: For example, '12345K' sorts before '1M', because M is "larger" than K.
162: This sort option is useful for sorting the output of a single invocation
163: of 'df' command with
164: .Fl h
165: or
166: .Fl H
167: options (human-readable).
168: .It Fl i , Fl Fl ignore-nonprinting
1.1 millert 169: Ignore all non-printable characters.
1.41 millert 170: .It Fl M, Fl Fl month-sort, Fl Fl sort=month
171: Sort by month abbreviations.
172: Unknown strings are considered smaller than valid month names.
173: .It Fl n , Fl Fl numeric-sort, Fl Fl sort=numeric
1.12 aaron 174: An initial numeric string, consisting of optional blank space, optional
175: minus sign, and zero or more digits (including decimal point)
1.1 millert 176: .\" with
177: .\" optional radix character and thousands
178: .\" separator
179: .\" (as defined in the current locale),
180: is sorted by arithmetic value.
1.41 millert 181: Leading blank characters are ignored.
182: .It Fl R, Fl Fl random-sort, Fl Fl sort=random
183: Sort lines in random order.
184: This is a random permutation of the inputs with the exception that
185: equal keys sort together.
186: It is implemented by hashing the input keys and sorting the hash values.
187: The hash function is randomized with data from
1.47 jmc 188: .Xr arc4random_buf 3 ,
1.41 millert 189: or by file content if one is specified via
190: .Fl Fl random-source .
191: If multiple sort fields are specified,
192: the same random hash function is used for all of them.
193: .It Fl r , Fl Fl reverse
194: Sort in reverse order.
195: .It Fl V, Fl Fl version-sort
196: Sort version numbers.
197: The input lines are treated as file names in form
198: PREFIX VERSION SUFFIX, where SUFFIX matches the regular expression
199: "(\.([A-Za-z~][A-Za-z0-9~]*)?)*".
200: The files are compared by their prefixes and versions (leading
201: zeros are ignored in version numbers, see example below).
202: If an input string does not match the pattern, then it is compared
203: using the byte compare function.
204: All string comparisons are performed in the C locale.
1.44 jmc 205: .Pp
206: For example:
207: .Bd -literal -offset indent
208: $ ls sort* | sort -V
209: sort-1.022.tgz
210: sort-1.23.tgz
211: sort-1.23.1.tgz
212: sort-1.024.tgz
213: sort-1.024.003.
214: sort-1.024.003.tgz
215: sort-1.024.07.tgz
216: sort-1.024.009.tgz
217: .Ed
1.1 millert 218: .El
219: .Pp
1.12 aaron 220: The treatment of field separators can be altered using these options:
1.1 millert 221: .Bl -tag -width indent
1.41 millert 222: .It Fl b , Fl Fl ignore-leading-blanks
223: Ignore leading blank space when determining the start
224: and end of a restricted sort key (see
225: .Fl k ) .
226: If
1.1 millert 227: .Fl b
1.41 millert 228: is specified before the first
1.1 millert 229: .Fl k
1.41 millert 230: option, it applies globally to all key specifications.
231: Otherwise,
1.1 millert 232: .Fl b
1.41 millert 233: can be attached independently to each
1.1 millert 234: .Ar field
1.41 millert 235: argument of the key specifications.
1.53 ! millert 236: Note that
! 237: .Fl b
! 238: should not appear after
! 239: .Fl k ,
! 240: and that it has no effect unless key fields are specified.
1.41 millert 241: .It Xo
1.42 jmc 242: .Fl k Ar field1 Ns Op , Ns Ar field2 ,
243: .Fl Fl key Ns = Ns Ar field1 Ns Op , Ns Ar field2
1.41 millert 244: .Xc
245: Define a restricted sort key that has the starting position
246: .Ar field1 ,
247: and optional ending position
248: .Ar field2
249: of a key field.
250: The
251: .Fl k
252: option may be specified multiple times,
253: in which case subsequent keys are compared after earlier keys compare equal.
254: The
1.1 millert 255: .Fl k
1.41 millert 256: option replaces the obsolete options
257: .Cm \(pl Ns Ar pos1
258: and
259: .Fl Ns Ar pos2 ,
260: but the old notation is also supported.
261: .It Fl t Ar char , Fl Fl field-separator Ns = Ns Ar char
262: Use
1.3 aaron 263: .Ar char
1.41 millert 264: as the field separator character.
1.8 aaron 265: The initial
1.1 millert 266: .Ar char
1.12 aaron 267: is not considered to be part of a field when determining key offsets.
1.1 millert 268: Each occurrence of
269: .Ar char
270: is significant (for example,
271: .Dq Ar charchar
272: delimits an empty field).
273: If
274: .Fl t
1.6 pjanzen 275: is not specified, the default field separator is a sequence of
276: blank-space characters, and consecutive blank spaces do
277: .Em not
278: delimit an empty field; further, the initial blank space
279: .Em is
280: considered part of a field when determining key offsets.
1.41 millert 281: To use NUL as field separator, use
282: .Fl t
283: \'\\0\'.
284: .It Fl z , Fl Fl zero-terminated
285: Use NUL as the record separator.
286: By default, records in the files are expected to be separated by
287: the newline characters.
288: With this option, NUL (\'\\0\') is used as the record separator character.
1.37 jmc 289: .El
290: .Pp
1.41 millert 291: Other options:
1.37 jmc 292: .Bl -tag -width indent
1.41 millert 293: .It Fl Fl batch-size Ns = Ns Ar num
294: Specify maximum number of files that can be opened by
295: .Nm
296: at once.
297: This option affects behavior when having many input files or using
298: temporary files.
1.51 millert 299: The minimum value is 2.
1.41 millert 300: The default value is 16.
301: .It Fl Fl compress-program Ns = Ns Ar program
302: Use
303: .Ar program
304: to compress temporary files.
305: When invoked with no arguments,
306: .Ar program
307: must compress standard input to standard output.
308: When called with the
309: .Fl d
310: option, it must decompress standard input to standard output.
311: If
312: .Ar program
313: fails,
314: .Nm
315: will exit with an error.
1.37 jmc 316: The
1.41 millert 317: .Xr compress 1
318: and
319: .Xr gzip 1
320: utilities meet these requirements.
321: .It Fl Fl debug
322: Print some extra information about the sorting process to the
323: standard output.
324: .It Fl Fl files0-from Ns = Ns Ar filename
325: Take the input file list from the file
1.44 jmc 326: .Ar filename .
1.41 millert 327: The file names must be separated by NUL
328: (like the output produced by the command
329: .Dq find ... -print0 ) .
1.49 jmc 330: .It Fl Fl heapsort
331: Try to use heap sort, if the sort specifications allow.
332: This sort algorithm cannot be used with
333: .Fl u
334: and
335: .Fl s .
336: .It Fl Fl help
337: Print the help text and exit.
338: .It Fl Fl mergesort , Fl H
1.41 millert 339: Use mergesort.
340: This is a universal algorithm that can always be used,
341: but it is not always the fastest.
1.49 jmc 342: .It Fl Fl mmap
343: Try to use file memory mapping system call.
344: It may increase speed in some cases.
1.41 millert 345: .It Fl Fl qsort
346: Try to use quick sort, if the sort specifications allow.
347: This sort algorithm cannot be used with
348: .Fl u
349: and
350: .Fl s .
1.49 jmc 351: .It Fl Fl radixsort
352: Try to use radix sort, if the sort specifications allow.
353: The radix sort can only be used for trivial locales (C and POSIX),
354: and it cannot be used for numeric or month sort.
355: Radix sort is very fast and stable.
356: .It Fl Fl random-source Ns = Ns Ar filename
357: For random sort, the contents of
358: .Ar filename
359: are used as the source of the
360: .Sq seed
361: data for the hash function.
362: Two invocations of random sort with the same seed data will use
363: produce the same result if the input is also identical.
364: By default, the
365: .Xr arc4random_buf 3
366: function is used instead.
367: .It Fl Fl version
368: Print the version and exit.
1.3 aaron 369: .El
1.1 millert 370: .Pp
1.12 aaron 371: A field is defined as a maximal sequence of characters other than the
1.6 pjanzen 372: field separator and record separator
373: .Pq newline by default .
374: Initial blank spaces are included in the field unless
375: .Fl b
376: has been specified;
377: the first blank space of a sequence of blank spaces acts as the field
378: separator and is included in the field (unless
379: .Fl t
380: is specified).
381: For example, by default all blank spaces at the beginning of a line are
382: considered to be part of the first field.
1.1 millert 383: .Pp
1.12 aaron 384: Fields are specified by the
1.45 jmc 385: .Fl k Ar field1 Ns Op , Ns Ar field2
1.41 millert 386: option.
387: If
1.1 millert 388: .Ar field2
1.41 millert 389: is missing, the end of the key defaults to the end of the line.
1.1 millert 390: .Pp
391: The arguments
392: .Ar field1
393: and
394: .Ar field2
395: have the form
396: .Em m.n
1.6 pjanzen 397: .Em (m,n > 0)
1.41 millert 398: and can be followed by one or more of the modifiers
1.6 pjanzen 399: .Cm b , d , f , i ,
1.41 millert 400: .Cm n , g , M
1.6 pjanzen 401: and
402: .Cm r ,
403: which correspond to the options discussed above.
1.41 millert 404: When
405: .Cm b
406: is specified it applies only to
407: .Ar field1
408: or
409: .Ar field2
410: where it is specified while the rest of the modifiers
411: apply to the whole key field regardless if they are
412: specified only with
413: .Ar field1
414: or
415: .Ar field2
416: or both.
1.1 millert 417: A
418: .Ar field1
419: position specified by
420: .Em m.n
421: is interpreted as the
422: .Em n Ns th
1.6 pjanzen 423: character from the beginning of the
1.1 millert 424: .Em m Ns th
425: field.
426: A missing
427: .Em \&.n
428: in
429: .Ar field1
430: means
431: .Ql \&.1 ,
432: indicating the first character of the
433: .Em m Ns th
1.12 aaron 434: field; if the
1.1 millert 435: .Fl b
436: option is in effect,
437: .Em n
1.12 aaron 438: is counted from the first non-blank character in the
1.1 millert 439: .Em m Ns th
440: field;
441: .Em m Ns \&.1b
1.12 aaron 442: refers to the first non-blank character in the
1.1 millert 443: .Em m Ns th
444: field.
1.6 pjanzen 445: .No 1\&. Ns Em n
446: refers to the
447: .Em n Ns th
448: character from the beginning of the line;
449: if
450: .Em n
451: is greater than the length of the line, the field is taken to be empty.
1.1 millert 452: .Pp
1.41 millert 453: .Em n Ns th
454: positions are always counted from the field beginning, even if the field
455: is shorter than the number of specified positions.
456: Thus, the key can really start from a position in a subsequent field.
457: .Pp
1.1 millert 458: A
459: .Ar field2
460: position specified by
461: .Em m.n
1.12 aaron 462: is interpreted as the
1.1 millert 463: .Em n Ns th
1.41 millert 464: character (including separators) from the beginning of the
1.1 millert 465: .Em m Ns th
466: field.
467: A missing
468: .Em \&.n
1.5 aaron 469: indicates the last character of the
1.1 millert 470: .Em m Ns th
471: field;
1.5 aaron 472: .Em m
1.1 millert 473: = \&0
474: designates the end of a line.
475: Thus the option
476: .Fl k Ar v.x,w.y
1.41 millert 477: is synonymous with the obsolete option
1.1 millert 478: .Cm \(pl Ns Ar v-\&1.x-\&1
479: .Fl Ns Ar w-\&1.y ;
480: when
481: .Em y
482: is omitted,
483: .Fl k Ar v.x,w
484: is synonymous with
1.5 aaron 485: .Cm \(pl Ns Ar v-\&1.x-\&1
1.19 tdeval 486: .Fl Ns Ar w\&.0 .
1.41 millert 487: The obsolete
1.1 millert 488: .Cm \(pl Ns Ar pos1
489: .Fl Ns Ar pos2
490: option is still supported, except for
1.3 aaron 491: .Fl Ns Ar w\&.0b ,
1.1 millert 492: which has no
493: .Fl k
494: equivalent.
495: .Sh ENVIRONMENT
496: .Bl -tag -width Fl
1.46 jmc 497: .It Ev GNUSORT_NUMERIC_COMPATIBILITY
498: If defined
499: .Fl t
500: will not override the locale numeric symbols, that is, thousand
501: separators and decimal separators.
502: By default, if we specify
503: .Fl t
504: with the same symbol as the thousand separator or decimal point,
505: the symbol will be treated as the field separator.
1.50 jmc 506: Older behavior was less definite: the symbol was treated as both field
1.46 jmc 507: separator and numeric separator, simultaneously.
508: This environment variable enables the old behavior.
509: .It Ev LANG
510: Used as a last resort to determine different kinds of locale-specific
1.50 jmc 511: behavior if neither the respective environment variable nor
1.46 jmc 512: .Ev LC_ALL
513: are set.
514: .It Ev LC_ALL
1.50 jmc 515: Locale settings that override all of the other locale settings.
1.46 jmc 516: This environment variable can be used to set all these settings
517: to the same value at once.
1.41 millert 518: .It Ev LC_COLLATE
519: Locale settings to be used to determine the collation for
520: sorting records.
521: .It Ev LC_CTYPE
522: Locale settings to be used to case conversion and classification
523: of characters, that is, which characters are considered
524: whitespaces, etc.
525: .It Ev LC_MESSAGES
526: Locale settings that determine the language of output messages
527: that
528: .Nm
529: prints out.
530: .It Ev LC_NUMERIC
531: Locale settings that determine the number format used in numeric sort.
532: .It Ev LC_TIME
533: Locale settings that determine the month format used in month sort.
1.1 millert 534: .It Ev TMPDIR
1.41 millert 535: Path to the directory in which temporary files will be stored.
1.3 aaron 536: Note that
1.1 millert 537: .Ev TMPDIR
538: may be overridden by the
539: .Fl T
540: option.
1.11 aaron 541: .El
1.1 millert 542: .Sh FILES
543: .Bl -tag -width Pa -compact
1.41 millert 544: .It Pa /var/tmp/.bsdsort.PID.*
545: Temporary files.
1.39 jmc 546: .El
547: .Sh EXIT STATUS
548: The
549: .Nm
550: utility exits with one of the following values:
551: .Pp
552: .Bl -tag -width Ds -offset indent -compact
553: .It 0
1.41 millert 554: Successfully sorted the input files or if used with
555: .Fl C
556: or
557: .Fl c ,
558: the input file already met the sorting criteria.
1.39 jmc 559: .It 1
1.41 millert 560: On disorder (or non-uniqueness) with the
1.39 jmc 561: .Fl C
562: or
563: .Fl c
1.41 millert 564: options.
1.39 jmc 565: .It 2
566: An error occurred.
1.1 millert 567: .El
568: .Sh SEE ALSO
569: .Xr comm 1 ,
1.3 aaron 570: .Xr join 1 ,
1.47 jmc 571: .Xr uniq 1
1.27 dlg 572: .Sh STANDARDS
573: The
574: .Nm
1.28 jmc 575: utility is compliant with the
1.33 jmc 576: .St -p1003.1-2008
1.27 dlg 577: specification.
578: .Pp
579: The flags
1.43 jmc 580: .Op Fl gHhiMRSsTVz
1.28 jmc 581: are extensions to that specification.
1.41 millert 582: .Pp
583: All long options are extensions to the specification.
584: Some are provided for compatibility with GNU
585: .Nm ,
586: others are specific to this implementation.
1.52 millert 587: .Pp
588: The historic practice of allowing the
589: .Fl o
590: option to appear after the
591: .Ar file
592: is supported for compatibility with older versions of
593: .Nm .
1.41 millert 594: .Pp
595: The historic key notations
596: .Cm \(pl Ns Ar pos1
597: and
598: .Fl Ns Ar pos2
599: are supported for compatibility with older versions of
600: .Nm
601: but their use is highly discouraged.
1.1 millert 602: .Sh HISTORY
603: A
1.8 aaron 604: .Nm
1.1 millert 605: command appeared in
1.16 mickey 606: .At v3 .
1.41 millert 607: .Sh AUTHORS
1.44 jmc 608: .An Gabor Kovesdan Aq Mt gabor@FreeBSD.org
609: .An Oleg Moskalenko Aq Mt mom040267@gmail.com
1.45 jmc 610: .Sh CAVEATS
1.41 millert 611: This implementation of
1.14 ericj 612: .Nm
613: has no limits on input line length (other than imposed by available
614: memory) or any restrictions on bytes allowed within lines.
615: .Pp
1.41 millert 616: The performance depends highly on locale settings,
617: efficient choice of sort keys and key complexity.
618: The fastest sort is with the C locale, on whole lines, with option
619: .Fl s .
620: In general, the C locale is the fastest, followed by single-byte
621: locales with multi-byte locales being the slowest.
622: The correct collation order respected in all cases.
623: For the key specification, the simpler to process the
624: lines the faster the search will be.
1.14 ericj 625: .Pp
1.41 millert 626: When sorting by arithmetic value, using
627: .Fl n
628: results in much better performance than
629: .Fl g
630: so its use is encouraged whenever possible.