4.4BSD/usr/share/man/cat1/sort.0

Compare this file to the similar file:
Show the results in this format:

SORT(1)                      BSD Reference Manual                      SORT(1)

NNAAMMEE
     ssoorrtt - sort or merge text files

SSYYNNOOPPSSIISS
     ssoorrtt [--mmuubbddffiinnrrttxx] [++_p_o_s_1 [--_p_o_s_2]] _._._. [--oo _o_u_t_p_u_t] [--TT _d_i_r_e_c_t_o_r_y] [_f_i_l_e]
          _._._.

DDEESSCCRRIIPPTTIIOONN
     The ssoorrtt utility sorts text files by lines.  Comparisons are based on one
     or more sort keys (or fields) extracted from each line of input, and are
     performed lexicographically. By default, if keys are not given, ssoorrtt re-
     gards each input line as a single field.

     The following options are available:

     --cc      Check that the single input file is sorted lexicographically.  If
             the file is not sorted, ssoorrtt sorts it and writes the sorted out-
             put to the standard output or the filename specified by the --oo
             option.

     --mm      Merge only; the input files are assumed to be pre-sorted.

     --oo _o_u_t_p_u_t
             The argument given is the name of an _o_u_t_p_u_t file to be used in-
             stead of the standard output.  This file can be the same as one
             of the input files.

     --TT _d_i_r_e_c_t_o_r_y
             The argument _d_i_r_e_c_t_o_r_y is used for creating temporary files.

     --uu      Unique: suppress all but one in each set of lines having equal
             keys.  If used with the --cc option, check that there are no lines
             with duplicate keys.

     The following options override the default ordering rules.  When ordering
     options appear independent of key field specifications, the requested
     field ordering rules are applied globally to all sort keys.

     --dd      Only blank space and alphanumeric characters are used in making
             comparisons.

     --ff      Considers all lowercase characters that have uppercase equiva-
             lents to be the same for purposes of comparison.

     --ii      Ignore all non-printable characters.

     --nn      An initial numeric string, consisting of optional blank space,
             optional minus sign, and zero or more digits (including decimal
             point) is sorted by arithmetic value.  The --nn option implies the
             --bb option. (See below.)  Note that the --bb option is only effec-
             tive when key fields have been specified and that --00 is consid-
             ered equal to zero.  Reverse the sense of comparisons.

     The treatment of field separators can be altered using the options:

     --bb      Leading blank spaces are ignored when determining the starting
             ending positions of a restricted sort key.  If the --bb option is
             specified before the first ++_p_o_s_1 argument, it shall be applied to
             all ++_p_o_s_1 arguments.  Otherwise, the --bb option can be attached
             independently to each ++_p_o_s_1 or --_p_o_s_2 argument (see below).

     --tt _c_h_a_r
             _C_h_a_r is used as the field separator character; _c_h_a_r is not con-
             sidered to be part of a field (although it can be included in a
             sort key).  Each occurrence of _c_h_a_r is significant (for example,
             ``_c_h_a_r_c_h_a_r'' delimits an empty field).  If --tt is not specified,
             blank space characters are used as default field separators.

     ++_p_o_s_1   Designates the start position of a key field.

     --_p_o_s_1   Designates the end position of a key field.

     The following operands are available: _f_i_l_e The pathname of a file to be
     sorted, merged, or checked.  If no file operands are specified, or if a
     file operand is --, the standard input is used.

     A field is defined as a minimal sequence of characters followed by a
     field separator or a newline character.  By default, the first blank
     space of a sequence of blank spaces acts as the field separator.  All
     blank spaces in a sequence of blank spaces are considered to be part of
     the next field; for example, all blank spaces at the beginning of a line
     are considered to be part of the first field.

     Fields are specified by the ++_p_o_s_1 and --_p_o_s_2 arguments.  A missing ++_p_o_s_1
     argument defaults to the beginning of a line.  A missing --_p_o_s_2 argument
     defaults to the end of a line.

     The arguments ++_p_o_s_1 and --_p_o_s_2 have the form _m_._n followed by one or more
     of the options --bb, --dd, --ff, --ii, --nn, --rr. A ++_p_o_s_1 position specified by _m_._n
     is interpreted to mean the _nth character in the _m+1th field.  A missing
     _._n means `.0', indicating the first character of the _m+1th field.  If the
     --bb option is in effect, _n is counted from the first non-blank character
     in the _m+1th field; _m.0b refers to the first non-blank character in the
     _m+1th field.

     A --_p_o_s_2 position specified by _m_._n is interpreted to mean the _nth charac-
     ter (including separators) after the last character of the _mth field.  A
     missing _._n means `.0', indicating the last character of the _mth field.
     If the --bb option is in effect, _n is counted from the last leading blank
     character in the _m+1th field; _m.1b refers to the first non-blank charac-
     ter in the _m+1th field.

FFIILLEESS
     /var/tmp/stm*, /tmp/*             Default temporary directories (in order
                                       of search).

SSEEEE AALLSSOO
     comm(1),  uniq(1),  join(1)

DDIIAAGGNNOOSSTTIICCSS
BBUUGGSS
     Lines which are longer than 4096 are discarded and processing continues.

HHIISSTTOORRYY
     A ssoorrtt command appeared in Version 6 AT&T UNIX.

4.4BSD                           June 10, 1993                               2