Annotation of 43BSDReno/usr.bin/sort/sort.1, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1990 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"     @(#)sort.1     6.5 (Berkeley) 6/24/90
                      6: .\"
                      7: .TH SORT 1 "June 24, 1990
                      8: .AT 3
                      9: .SH NAME
                     10: sort \- sort or merge files
                     11: .SH SYNOPSIS
                     12: .B sort
                     13: [
                     14: .I -mubdfinrtx
                     15: ]
                     16: [ \fB+\fIpos1 \fR [ \fB\-\fIpos2 \fR]
                     17: ] ...
                     18: [ 
                     19: .B \-o 
                     20: name ] [
                     21: .B \-T
                     22: directory ] [ name ] ...
                     23: .SH DESCRIPTION
                     24: .I Sort
                     25: sorts lines of all the named files together and writes the result on
                     26: the standard output.  The name `\-' means the standard input.
                     27: If no input files are named, the standard input is sorted.
                     28: .LP
                     29: The default sort key is an entire line.
                     30: Default ordering is lexicographic by bytes in machine collating sequence.
                     31: The ordering is affected globally by the following options,
                     32: one or more of which may appear.
                     33: .TP 5
                     34: .B  b
                     35: Ignore leading blanks (spaces and tabs) in field comparisons.
                     36: .TP 5
                     37: .B  d
                     38: `Dictionary' order: only letters, digits and blanks
                     39: are significant in comparisons.
                     40: .TP 5
                     41: .B  f
                     42: Fold upper case letters onto lower case.
                     43: .TP 5
                     44: .B  i
                     45: Ignore characters outside the ASCII range 040-0176 in nonnumeric comparisons.
                     46: .TP 5
                     47: .B  n
                     48: An initial numeric string, consisting of optional blanks, optional minus sign,
                     49: and zero or more digits with optional decimal point,
                     50: is sorted by arithmetic value.  (Note that \fB-0\fP is considered equal
                     51: to \fB0\fP.) Option
                     52: .B n
                     53: implies option
                     54: .B b.
                     55: .TP 5
                     56: .B  r
                     57: Reverse the sense of comparisons.
                     58: .TP 5
                     59: .BI t x
                     60: `Tab character' separating fields is
                     61: .IR x .
                     62: .LP
                     63: The notation
                     64: .BI + "pos1 " "\-\fIpos2"
                     65: restricts a sort key to a field beginning at
                     66: .I pos1
                     67: and ending just before
                     68: .IR pos2 .
                     69: .I Pos1
                     70: and
                     71: .I pos2
                     72: each have the form
                     73: .IB m . n\fR,
                     74: optionally followed by one or more of the flags
                     75: .B bdf\&inr,
                     76: where
                     77: .I m
                     78: tells a number of fields to skip from the beginning of the line and
                     79: .I n
                     80: tells a number of characters to skip further.
                     81: If any flags are present they override all the global
                     82: ordering options for this key.  If the
                     83: .B b
                     84: option is in effect
                     85: .I n
                     86: is counted from the first nonblank in the field;
                     87: .B b
                     88: is attached independently to 
                     89: .IR pos2 .
                     90: A missing \&\fB.\fIn\fR means .0; a missing
                     91: .BI \- pos2
                     92: means the end of the line.  Under the
                     93: .BI \-t x
                     94: option, fields are strings separated by
                     95: .IR x ;
                     96: otherwise fields are nonempty nonblank strings separated by blanks.
                     97: .LP
                     98: When there are multiple sort keys, later keys
                     99: are compared only after all earlier keys compare equal.
                    100: Lines that otherwise compare equal are ordered with all bytes significant.
                    101: .LP
                    102: These option arguments are also understood:
                    103: .TP 5
                    104: .B c
                    105: Check that the input file is sorted according to the ordering rules;
                    106: give no output unless the file is out of sort.
                    107: .TP 5
                    108: .B  m
                    109: Merge only, the input files are already sorted.
                    110: .TP 5
                    111: .B  o
                    112: The next argument is the name of an output file
                    113: to use instead of the standard output.
                    114: This file may be the same as one of the inputs.
                    115: .TP 5
                    116: .B T
                    117: The next argument is the name of a directory in which temporary files
                    118: should be made.
                    119: .TP 5
                    120: .B  u
                    121: Suppress all but one in each set of equal lines.
                    122: Ignored bytes and bytes outside keys do not participate in this comparison.
                    123: .SH EXAMPLES
                    124: .LP
                    125: Print in alphabetical order all the unique spellings in a list of words.
                    126: Capitalized words differ from uncapitalized.
                    127: .LP
                    128: .ti +8
                    129: sort \-u +0f +0 list
                    130: .LP
                    131: Print the password file
                    132: .RI ( passwd (5))
                    133: sorted by user id number (the 3rd colon-separated field).
                    134: .LP
                    135: .ti +8
                    136: sort \-t: +2n /etc/passwd
                    137: .LP
                    138: Print the first instance of each month in an already sorted file
                    139: of (month day) entries.
                    140: The options
                    141: .B \-um
                    142: with just one input file make the choice of a
                    143: unique representative from a set of equal lines predictable.
                    144: .LP
                    145: .ti +8
                    146: sort \-um +0 \-1 dates
                    147: .SH FILES
                    148: /usr/tmp/stm*, /tmp/*  first and second tries for
                    149: temporary files
                    150: .SH "SEE ALSO"
                    151: uniq(1),
                    152: comm(1),
                    153: rev(1),
                    154: join(1)
                    155: .SH DIAGNOSTICS
                    156: Comments and exits with nonzero status for various trouble
                    157: conditions and for disorder discovered under option
                    158: .BR \-c .
                    159: .SH BUGS
                    160: Very long lines are silently truncated.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.