[BACK]Return to sort.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / sort

Annotation of src/usr.bin/sort/sort.1, Revision 1.52

1.52    ! millert     1: .\"    $OpenBSD: sort.1,v 1.51 2015/04/01 19:56:01 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.52    ! millert    35: .Dd $Mdocdate: April 1 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 b, Fl Fl ignore-leading-blanks
                    141: Ignore leading blank characters when comparing lines.
                    142: .It Fl d , Fl Fl dictionary-order
                    143: Consider only blank spaces and alphanumeric characters in comparisons.
                    144: .It Fl f , Fl Fl ignore-case
                    145: Consider all lowercase characters that have uppercase
1.12      aaron     146: equivalents to be the same for purposes of comparison.
1.41      millert   147: .It Fl g, Fl Fl general-numeric-sort, Fl Fl sort=general-numeric
                    148: Sort by general numerical value.
                    149: As opposed to
                    150: .Fl n ,
1.50      jmc       151: this option handles general floating points.
                    152: It has a more
                    153: permissive format than that allowed by
                    154: .Fl n
1.41      millert   155: but it has a significant performance drawback.
                    156: .It Fl h, Fl Fl human-numeric-sort, Fl Fl sort=human-numeric
                    157: Sort by numerical value, but take into account the SI suffix,
                    158: if present.
                    159: Sorts first by numeric sign (negative, zero, or
                    160: positive); then by SI suffix (either empty, or `k' or `K', or one
                    161: of `MGTPEZY', in that order); and finally by numeric value.
                    162: The SI suffix must immediately follow the number.
                    163: For example, '12345K' sorts before '1M', because M is "larger" than K.
                    164: This sort option is useful for sorting the output of a single invocation
                    165: of 'df' command with
                    166: .Fl h
                    167: or
                    168: .Fl H
                    169: options (human-readable).
                    170: .It Fl i , Fl Fl ignore-nonprinting
1.1       millert   171: Ignore all non-printable characters.
1.41      millert   172: .It Fl M, Fl Fl month-sort, Fl Fl sort=month
                    173: Sort by month abbreviations.
                    174: Unknown strings are considered smaller than valid month names.
                    175: .It Fl n , Fl Fl numeric-sort, Fl Fl sort=numeric
1.12      aaron     176: An initial numeric string, consisting of optional blank space, optional
                    177: minus sign, and zero or more digits (including decimal point)
1.1       millert   178: .\" with
                    179: .\" optional radix character and thousands
                    180: .\" separator
                    181: .\" (as defined in the current locale),
                    182: is sorted by arithmetic value.
1.41      millert   183: Leading blank characters are ignored.
                    184: .It Fl R, Fl Fl random-sort, Fl Fl sort=random
                    185: Sort lines in random order.
                    186: This is a random permutation of the inputs with the exception that
                    187: equal keys sort together.
                    188: It is implemented by hashing the input keys and sorting the hash values.
                    189: The hash function is randomized with data from
1.47      jmc       190: .Xr arc4random_buf 3 ,
1.41      millert   191: or by file content if one is specified via
                    192: .Fl Fl random-source .
                    193: If multiple sort fields are specified,
                    194: the same random hash function is used for all of them.
                    195: .It Fl r , Fl Fl reverse
                    196: Sort in reverse order.
                    197: .It Fl V, Fl Fl version-sort
                    198: Sort version numbers.
                    199: The input lines are treated as file names in form
                    200: PREFIX VERSION SUFFIX, where SUFFIX matches the regular expression
                    201: "(\.([A-Za-z~][A-Za-z0-9~]*)?)*".
                    202: The files are compared by their prefixes and versions (leading
                    203: zeros are ignored in version numbers, see example below).
                    204: If an input string does not match the pattern, then it is compared
                    205: using the byte compare function.
                    206: All string comparisons are performed in the C locale.
1.44      jmc       207: .Pp
                    208: For example:
                    209: .Bd -literal -offset indent
                    210: $ ls sort* | sort -V
                    211: sort-1.022.tgz
                    212: sort-1.23.tgz
                    213: sort-1.23.1.tgz
                    214: sort-1.024.tgz
                    215: sort-1.024.003.
                    216: sort-1.024.003.tgz
                    217: sort-1.024.07.tgz
                    218: sort-1.024.009.tgz
                    219: .Ed
1.1       millert   220: .El
                    221: .Pp
1.12      aaron     222: The treatment of field separators can be altered using these options:
1.1       millert   223: .Bl -tag -width indent
1.41      millert   224: .It Fl b , Fl Fl ignore-leading-blanks
                    225: Ignore leading blank space when determining the start
                    226: and end of a restricted sort key (see
                    227: .Fl k ) .
                    228: If
1.1       millert   229: .Fl b
1.41      millert   230: is specified before the first
1.1       millert   231: .Fl k
1.41      millert   232: option, it applies globally to all key specifications.
                    233: Otherwise,
1.1       millert   234: .Fl b
1.41      millert   235: can be attached independently to each
1.1       millert   236: .Ar field
1.41      millert   237: argument of the key specifications.
                    238: .It Xo
1.42      jmc       239: .Fl k Ar field1 Ns Op , Ns Ar field2 ,
                    240: .Fl Fl key Ns = Ns Ar field1 Ns Op , Ns Ar field2
1.41      millert   241: .Xc
                    242: Define a restricted sort key that has the starting position
                    243: .Ar field1 ,
                    244: and optional ending position
                    245: .Ar field2
                    246: of a key field.
                    247: The
                    248: .Fl k
                    249: option may be specified multiple times,
                    250: in which case subsequent keys are compared after earlier keys compare equal.
                    251: The
1.1       millert   252: .Fl k
1.41      millert   253: option replaces the obsolete options
                    254: .Cm \(pl Ns Ar pos1
                    255: and
                    256: .Fl Ns Ar pos2 ,
                    257: but the old notation is also supported.
                    258: .It Fl t Ar char , Fl Fl field-separator Ns = Ns Ar char
                    259: Use
1.3       aaron     260: .Ar char
1.41      millert   261: as the field separator character.
1.8       aaron     262: The initial
1.1       millert   263: .Ar char
1.12      aaron     264: is not considered to be part of a field when determining key offsets.
1.1       millert   265: Each occurrence of
                    266: .Ar char
                    267: is significant (for example,
                    268: .Dq Ar charchar
                    269: delimits an empty field).
                    270: If
                    271: .Fl t
1.6       pjanzen   272: is not specified, the default field separator is a sequence of
                    273: blank-space characters, and consecutive blank spaces do
                    274: .Em not
                    275: delimit an empty field; further, the initial blank space
                    276: .Em is
                    277: considered part of a field when determining key offsets.
1.41      millert   278: To use NUL as field separator, use
                    279: .Fl t
                    280: \'\\0\'.
                    281: .It Fl z , Fl Fl zero-terminated
                    282: Use NUL as the record separator.
                    283: By default, records in the files are expected to be separated by
                    284: the newline characters.
                    285: With this option, NUL (\'\\0\') is used as the record separator character.
1.37      jmc       286: .El
                    287: .Pp
1.41      millert   288: Other options:
1.37      jmc       289: .Bl -tag -width indent
1.41      millert   290: .It Fl Fl batch-size Ns = Ns Ar num
                    291: Specify maximum number of files that can be opened by
                    292: .Nm
                    293: at once.
                    294: This option affects behavior when having many input files or using
                    295: temporary files.
1.51      millert   296: The minimum value is 2.
1.41      millert   297: The default value is 16.
                    298: .It Fl Fl compress-program Ns = Ns Ar program
                    299: Use
                    300: .Ar program
                    301: to compress temporary files.
                    302: When invoked with no arguments,
                    303: .Ar program
                    304: must compress standard input to standard output.
                    305: When called with the
                    306: .Fl d
                    307: option, it must decompress standard input to standard output.
                    308: If
                    309: .Ar program
                    310: fails,
                    311: .Nm
                    312: will exit with an error.
1.37      jmc       313: The
1.41      millert   314: .Xr compress 1
                    315: and
                    316: .Xr gzip 1
                    317: utilities meet these requirements.
                    318: .It Fl Fl debug
                    319: Print some extra information about the sorting process to the
                    320: standard output.
                    321: .It Fl Fl files0-from Ns = Ns Ar filename
                    322: Take the input file list from the file
1.44      jmc       323: .Ar filename .
1.41      millert   324: The file names must be separated by NUL
                    325: (like the output produced by the command
                    326: .Dq find ... -print0 ) .
1.49      jmc       327: .It Fl Fl heapsort
                    328: Try to use heap sort, if the sort specifications allow.
                    329: This sort algorithm cannot be used with
                    330: .Fl u
                    331: and
                    332: .Fl s .
                    333: .It Fl Fl help
                    334: Print the help text and exit.
                    335: .It Fl Fl mergesort , Fl H
1.41      millert   336: Use mergesort.
                    337: This is a universal algorithm that can always be used,
                    338: but it is not always the fastest.
1.49      jmc       339: .It Fl Fl mmap
                    340: Try to use file memory mapping system call.
                    341: It may increase speed in some cases.
1.41      millert   342: .It Fl Fl qsort
                    343: Try to use quick sort, if the sort specifications allow.
                    344: This sort algorithm cannot be used with
                    345: .Fl u
                    346: and
                    347: .Fl s .
1.49      jmc       348: .It Fl Fl radixsort
                    349: Try to use radix sort, if the sort specifications allow.
                    350: The radix sort can only be used for trivial locales (C and POSIX),
                    351: and it cannot be used for numeric or month sort.
                    352: Radix sort is very fast and stable.
                    353: .It Fl Fl random-source Ns = Ns Ar filename
                    354: For random sort, the contents of
                    355: .Ar filename
                    356: are used as the source of the
                    357: .Sq seed
                    358: data for the hash function.
                    359: Two invocations of random sort with the same seed data will use
                    360: produce the same result if the input is also identical.
                    361: By default, the
                    362: .Xr arc4random_buf 3
                    363: function is used instead.
                    364: .It Fl Fl version
                    365: Print the version and exit.
1.3       aaron     366: .El
1.1       millert   367: .Pp
1.12      aaron     368: A field is defined as a maximal sequence of characters other than the
1.6       pjanzen   369: field separator and record separator
                    370: .Pq newline by default .
                    371: Initial blank spaces are included in the field unless
                    372: .Fl b
                    373: has been specified;
                    374: the first blank space of a sequence of blank spaces acts as the field
                    375: separator and is included in the field (unless
                    376: .Fl t
                    377: is specified).
                    378: For example, by default all blank spaces at the beginning of a line are
                    379: considered to be part of the first field.
1.1       millert   380: .Pp
1.12      aaron     381: Fields are specified by the
1.45      jmc       382: .Fl k Ar field1 Ns Op , Ns Ar field2
1.41      millert   383: option.
                    384: If
1.1       millert   385: .Ar field2
1.41      millert   386: is missing, the end of the key defaults to the end of the line.
1.1       millert   387: .Pp
                    388: The arguments
                    389: .Ar field1
                    390: and
                    391: .Ar field2
                    392: have the form
                    393: .Em m.n
1.6       pjanzen   394: .Em (m,n > 0)
1.41      millert   395: and can be followed by one or more of the modifiers
1.6       pjanzen   396: .Cm b , d , f , i ,
1.41      millert   397: .Cm n , g , M
1.6       pjanzen   398: and
                    399: .Cm r ,
                    400: which correspond to the options discussed above.
1.41      millert   401: When
                    402: .Cm b
                    403: is specified it applies only to
                    404: .Ar field1
                    405: or
                    406: .Ar field2
                    407: where it is specified while the rest of the modifiers
                    408: apply to the whole key field regardless if they are
                    409: specified only with
                    410: .Ar field1
                    411: or
                    412: .Ar field2
                    413: or both.
1.1       millert   414: A
                    415: .Ar field1
                    416: position specified by
                    417: .Em m.n
                    418: is interpreted as the
                    419: .Em n Ns th
1.6       pjanzen   420: character from the beginning of the
1.1       millert   421: .Em m Ns th
                    422: field.
                    423: A missing
                    424: .Em \&.n
                    425: in
                    426: .Ar field1
                    427: means
                    428: .Ql \&.1 ,
                    429: indicating the first character of the
                    430: .Em m Ns th
1.12      aaron     431: field; if the
1.1       millert   432: .Fl b
                    433: option is in effect,
                    434: .Em n
1.12      aaron     435: is counted from the first non-blank character in the
1.1       millert   436: .Em m Ns th
                    437: field;
                    438: .Em m Ns \&.1b
1.12      aaron     439: refers to the first non-blank character in the
1.1       millert   440: .Em m Ns th
                    441: field.
1.6       pjanzen   442: .No 1\&. Ns Em n
                    443: refers to the
                    444: .Em n Ns th
                    445: character from the beginning of the line;
                    446: if
                    447: .Em n
                    448: is greater than the length of the line, the field is taken to be empty.
1.1       millert   449: .Pp
1.41      millert   450: .Em n Ns th
                    451: positions are always counted from the field beginning, even if the field
                    452: is shorter than the number of specified positions.
                    453: Thus, the key can really start from a position in a subsequent field.
                    454: .Pp
1.1       millert   455: A
                    456: .Ar field2
                    457: position specified by
                    458: .Em m.n
1.12      aaron     459: is interpreted as the
1.1       millert   460: .Em n Ns th
1.41      millert   461: character (including separators) from the beginning of the
1.1       millert   462: .Em m Ns th
                    463: field.
                    464: A missing
                    465: .Em \&.n
1.5       aaron     466: indicates the last character of the
1.1       millert   467: .Em m Ns th
                    468: field;
1.5       aaron     469: .Em m
1.1       millert   470: = \&0
                    471: designates the end of a line.
                    472: Thus the option
                    473: .Fl k Ar v.x,w.y
1.41      millert   474: is synonymous with the obsolete option
1.1       millert   475: .Cm \(pl Ns Ar v-\&1.x-\&1
                    476: .Fl Ns Ar w-\&1.y ;
                    477: when
                    478: .Em y
                    479: is omitted,
                    480: .Fl k Ar v.x,w
                    481: is synonymous with
1.5       aaron     482: .Cm \(pl Ns Ar v-\&1.x-\&1
1.19      tdeval    483: .Fl Ns Ar w\&.0 .
1.41      millert   484: The obsolete
1.1       millert   485: .Cm \(pl Ns Ar pos1
                    486: .Fl Ns Ar pos2
                    487: option is still supported, except for
1.3       aaron     488: .Fl Ns Ar w\&.0b ,
1.1       millert   489: which has no
                    490: .Fl k
                    491: equivalent.
                    492: .Sh ENVIRONMENT
                    493: .Bl -tag -width Fl
1.46      jmc       494: .It Ev GNUSORT_NUMERIC_COMPATIBILITY
                    495: If defined
                    496: .Fl t
                    497: will not override the locale numeric symbols, that is, thousand
                    498: separators and decimal separators.
                    499: By default, if we specify
                    500: .Fl t
                    501: with the same symbol as the thousand separator or decimal point,
                    502: the symbol will be treated as the field separator.
1.50      jmc       503: Older behavior was less definite: the symbol was treated as both field
1.46      jmc       504: separator and numeric separator, simultaneously.
                    505: This environment variable enables the old behavior.
                    506: .It Ev LANG
                    507: Used as a last resort to determine different kinds of locale-specific
1.50      jmc       508: behavior if neither the respective environment variable nor
1.46      jmc       509: .Ev LC_ALL
                    510: are set.
                    511: .It Ev LC_ALL
1.50      jmc       512: Locale settings that override all of the other locale settings.
1.46      jmc       513: This environment variable can be used to set all these settings
                    514: to the same value at once.
1.41      millert   515: .It Ev LC_COLLATE
                    516: Locale settings to be used to determine the collation for
                    517: sorting records.
                    518: .It Ev LC_CTYPE
                    519: Locale settings to be used to case conversion and classification
                    520: of characters, that is, which characters are considered
                    521: whitespaces, etc.
                    522: .It Ev LC_MESSAGES
                    523: Locale settings that determine the language of output messages
                    524: that
                    525: .Nm
                    526: prints out.
                    527: .It Ev LC_NUMERIC
                    528: Locale settings that determine the number format used in numeric sort.
                    529: .It Ev LC_TIME
                    530: Locale settings that determine the month format used in month sort.
1.1       millert   531: .It Ev TMPDIR
1.41      millert   532: Path to the directory in which temporary files will be stored.
1.3       aaron     533: Note that
1.1       millert   534: .Ev TMPDIR
                    535: may be overridden by the
                    536: .Fl T
                    537: option.
1.11      aaron     538: .El
1.1       millert   539: .Sh FILES
                    540: .Bl -tag -width Pa -compact
1.41      millert   541: .It Pa /var/tmp/.bsdsort.PID.*
                    542: Temporary files.
1.39      jmc       543: .El
                    544: .Sh EXIT STATUS
                    545: The
                    546: .Nm
                    547: utility exits with one of the following values:
                    548: .Pp
                    549: .Bl -tag -width Ds -offset indent -compact
                    550: .It 0
1.41      millert   551: Successfully sorted the input files or if used with
                    552: .Fl C
                    553: or
                    554: .Fl c ,
                    555: the input file already met the sorting criteria.
1.39      jmc       556: .It 1
1.41      millert   557: On disorder (or non-uniqueness) with the
1.39      jmc       558: .Fl C
                    559: or
                    560: .Fl c
1.41      millert   561: options.
1.39      jmc       562: .It 2
                    563: An error occurred.
1.1       millert   564: .El
                    565: .Sh SEE ALSO
                    566: .Xr comm 1 ,
1.3       aaron     567: .Xr join 1 ,
1.47      jmc       568: .Xr uniq 1
1.27      dlg       569: .Sh STANDARDS
                    570: The
                    571: .Nm
1.28      jmc       572: utility is compliant with the
1.33      jmc       573: .St -p1003.1-2008
1.27      dlg       574: specification.
                    575: .Pp
                    576: The flags
1.43      jmc       577: .Op Fl gHhiMRSsTVz
1.28      jmc       578: are extensions to that specification.
1.41      millert   579: .Pp
                    580: All long options are extensions to the specification.
                    581: Some are provided for compatibility with GNU
                    582: .Nm ,
                    583: others are specific to this implementation.
1.52    ! millert   584: .Pp
        !           585: The historic practice of allowing the
        !           586: .Fl o
        !           587: option to appear after the
        !           588: .Ar file
        !           589: is supported for compatibility with older versions of
        !           590: .Nm .
1.41      millert   591: .Pp
                    592: The historic key notations
                    593: .Cm \(pl Ns Ar pos1
                    594: and
                    595: .Fl Ns Ar pos2
                    596: are supported for compatibility with older versions of
                    597: .Nm
                    598: but their use is highly discouraged.
1.1       millert   599: .Sh HISTORY
                    600: A
1.8       aaron     601: .Nm
1.1       millert   602: command appeared in
1.16      mickey    603: .At v3 .
1.41      millert   604: .Sh AUTHORS
1.44      jmc       605: .An Gabor Kovesdan Aq Mt gabor@FreeBSD.org
                    606: .An Oleg Moskalenko Aq Mt mom040267@gmail.com
1.45      jmc       607: .Sh CAVEATS
1.41      millert   608: This implementation of
1.14      ericj     609: .Nm
                    610: has no limits on input line length (other than imposed by available
                    611: memory) or any restrictions on bytes allowed within lines.
                    612: .Pp
1.41      millert   613: The performance depends highly on locale settings,
                    614: efficient choice of sort keys and key complexity.
                    615: The fastest sort is with the C locale, on whole lines, with option
                    616: .Fl s .
                    617: In general, the C locale is the fastest, followed by single-byte
                    618: locales with multi-byte locales being the slowest.
                    619: The correct collation order respected in all cases.
                    620: For the key specification, the simpler to process the
                    621: lines the faster the search will be.
1.14      ericj     622: .Pp
1.41      millert   623: When sorting by arithmetic value, using
                    624: .Fl n
                    625: results in much better performance than
                    626: .Fl g
                    627: so its use is encouraged whenever possible.