Annotation of researchv10no/cmd/sort/sort.1, revision 1.1

1.1     ! root        1: .TH SORT 1 
        !             2: .CT 1 files
        !             3: .SH NAME
        !             4: sort \- sort and/or merge files
        !             5: .SH SYNOPSIS
        !             6: .B sort
        !             7: [
        !             8: .BI -cmusMbdf\&inrt x
        !             9: ]
        !            10: [
        !            11: .B -o
        !            12: .I output
        !            13: ]
        !            14: [
        !            15: .I option ...
        !            16: ]
        !            17: [
        !            18: .I file ...
        !            19: ]
        !            20: .SH DESCRIPTION
        !            21: .I Sort\^
        !            22: sorts
        !            23: lines of all the
        !            24: .I files
        !            25: together and writes the result on
        !            26: the standard output.
        !            27: The name
        !            28: .B -
        !            29: means
        !            30: the standard input.
        !            31: If no input files are named, the standard input is sorted.
        !            32: .PP
        !            33: The default sort key is an entire line.
        !            34: Default ordering is
        !            35: lexicographic by bytes in machine
        !            36: collating sequence.
        !            37: The ordering is affected globally by the following options,
        !            38: one or more of which may appear.
        !            39: .TP
        !            40: .B -b
        !            41: Ignore leading white space (spaces and tabs) in field comparisons.
        !            42: .TP
        !            43: .B -d
        !            44: `Phone directory' order: only letters, digits and white space
        !            45: are significant in string comparisons.
        !            46: .TP
        !            47: .B -f
        !            48: Fold lower case
        !            49: letters onto upper case.
        !            50: .TP
        !            51: .B -i
        !            52: Ignore characters outside the
        !            53: .SM ASCII
        !            54: range 040-0176
        !            55: in string comparisons.
        !            56: .TP
        !            57: .B -n
        !            58: An initial numeric string,
        !            59: consisting of optional white space, optional sign, and
        !            60: a nonempty string of digits with optional decimal point,
        !            61: is sorted by value.
        !            62: .TP
        !            63: .B -g
        !            64: Numeric, like
        !            65: .BR -n ,
        !            66: with
        !            67: .BR e -style
        !            68: exponents allowed.
        !            69: .TP
        !            70: .B -M
        !            71: Compare as month names.
        !            72: The first three
        !            73: characters after optional white space
        !            74: are folded to lower case and compared.
        !            75: Invalid fields compare low to
        !            76: .LR jan .
        !            77: .TP
        !            78: .B -r
        !            79: Reverse the sense of comparisons.
        !            80: .TP
        !            81: .BI -t x\^
        !            82: `Tab character' separating fields is
        !            83: .IR x .
        !            84: .TP
        !            85: .BI -k " pos1" , pos2
        !            86: Restrict the sort key to a string beginning at
        !            87: .I pos1\^
        !            88: and ending at
        !            89: .IR pos2 .
        !            90: .I Pos1\^
        !            91: and
        !            92: .I pos2\^
        !            93: each have the form
        !            94: .IB m . n ,
        !            95: optionally followed by one or more of the flags
        !            96: .BR Mbdfginr ;
        !            97: .I m\^
        !            98: counts fields from the beginning of the line and
        !            99: .I n\^
        !           100: counts characters from the beginning of the field.
        !           101: If any flags are present they override all the global
        !           102: ordering options for this key.
        !           103: If
        !           104: .BI \&. n\^
        !           105: is missing from 
        !           106: .I pos1,
        !           107: it is taken to be 1; if missing from
        !           108: .IR pos2, 
        !           109: it is taken to be the end of the field.
        !           110: If 
        !           111: .I pos2
        !           112: is missing, it is taken to be end of line.
        !           113: .TP
        !           114: .BI -a " pos1" , pos2
        !           115: .IB Pos1 , pos2
        !           116: designates an accumulating 
        !           117: .BR -n -style
        !           118: field, disjoint from the sort key.
        !           119: When the keys of two records compare equal,
        !           120: discard the second and replace the
        !           121: accumulating field in the first with the sum of
        !           122: that field in both.
        !           123: The receiving field must be large enough for the sum
        !           124: to fit without destroying any field separator.
        !           125: The sum has a ones digit always, a decimal point if
        !           126: either addend has one, a fraction part as long as
        !           127: that of either addend, leading zeros padded to full
        !           128: field width if either addend has a leading zero 
        !           129: before the ones digit, and a
        !           130: .B +
        !           131: sign if either addend has a
        !           132: .B +
        !           133: sign and the sum is not negative.
        !           134: .PP
        !           135: Under option
        !           136: .BI -t x\^
        !           137: fields are strings separated by
        !           138: .IR x ;
        !           139: otherwise fields are
        !           140: non-empty strings separated by white space.
        !           141: White space before a field
        !           142: is part of the field, except under option
        !           143: .BR -b .
        !           144: A
        !           145: .B b
        !           146: flag may be attached independently to
        !           147: .IR pos1
        !           148: and
        !           149: .IR pos2.
        !           150: .PP
        !           151: When there are multiple sort keys, later keys
        !           152: are compared only after all earlier keys
        !           153: compare equal.
        !           154: Except under option 
        !           155: .BR -s ,
        !           156: lines with all keys equal are ordered
        !           157: with all bytes significant.
        !           158: .PP
        !           159: Single-letter options may be combined into a single
        !           160: string, such as
        !           161: .BR -cnrt: .
        !           162: The option combination
        !           163: .B -di
        !           164: and the combination of
        !           165: .B -n
        !           166: with any of
        !           167: .BR -diM 
        !           168: are improper.
        !           169: .PP
        !           170: These option arguments are also understood:
        !           171: .TP
        !           172: .B -c
        !           173: Check that the single input file is sorted according to the ordering rules;
        !           174: give no output unless the file is out of sort.
        !           175: .TP
        !           176: .B -m
        !           177: Merge; the input files are already sorted.
        !           178: .TP
        !           179: .B -u
        !           180: Unique.  Keep only the first of two lines 
        !           181: that compare equal on all keys.
        !           182: Implies
        !           183: .BR -s .
        !           184: .TP
        !           185: .B -s
        !           186: Stable sort.
        !           187: When all keys compare equal, preserve input order.
        !           188: Unaffected by
        !           189: .BR -r .
        !           190: .TP
        !           191: .BI -o " output
        !           192: Place output in a designated file
        !           193: instead of on the standard output.
        !           194: This file may be the same as one of the inputs.
        !           195: The option may appear among the
        !           196: .I file
        !           197: arguments, except after 
        !           198: .BR -- .
        !           199: .TP
        !           200: .BI + pos1 " -" pos2
        !           201: Classical alternative to
        !           202: .BR -k ,
        !           203: with counting from 0 instead of 1, and
        !           204: .I pos2
        !           205: designating next-after-last instead of last character of the key.
        !           206: A missing character count in
        !           207: .I pos2
        !           208: means 0, which in turn excludes any 
        !           209: .B -t
        !           210: tab character from the end of the key.
        !           211: Thus
        !           212: .B "+1\ -1.3"
        !           213: means the same as 
        !           214: .B -k\ 2,2.3
        !           215: and
        !           216: .B "+1r\ -3"
        !           217: means the same as
        !           218: .BR "-k\ 2r,3" .
        !           219: .PP
        !           220: Options
        !           221: .BR -a ,
        !           222: .BR -g ,
        !           223: .BR -M ,
        !           224: and
        !           225: .BR -s
        !           226: are not in the Posix standard, nor are
        !           227: the following tuning options.
        !           228: .TP
        !           229: .BI -T " tempdir
        !           230: Put temporary files in
        !           231: .I tempdir
        !           232: rather than in
        !           233: .BR /usr/tmp .
        !           234: .TP
        !           235: .BI -y " n"
        !           236: Use up to 
        !           237: .I n
        !           238: bytes of internal store, or a huge number if
        !           239: .IR n =0.
        !           240: .TP
        !           241: .B -w " n"
        !           242: Merge up to
        !           243: .I n
        !           244: files at a time.
        !           245: .ig
        !           246: .TP
        !           247: .BI -z recsize
        !           248: Provide for abnormally large records;
        !           249: useful only with
        !           250: .B -c
        !           251: and
        !           252: .B -m
        !           253: ..
        !           254: .SH EXAMPLES
        !           255: .TP
        !           256: .B sort -u -k1f -k1 list
        !           257: Print in alphabetical order all the unique spellings
        !           258: in a list of words
        !           259: where capitalized words differ from uncapitalized.
        !           260: .TP
        !           261: .B sort -t: -k3n /etc/passwd
        !           262: Print the password file
        !           263: .RI ( passwd (5))
        !           264: sorted by userid
        !           265: (the third colon-separated field).
        !           266: .TP
        !           267: .B sort -umM dates
        !           268: Print the first instance of each month in an already sorted file.
        !           269: .TP
        !           270: .B sort -k1,1 -a2,2 items_and_costs
        !           271: Reduce a file of items (field 1) and costs (field 2) to
        !           272: a summary file of total cost per type of item.
        !           273: .SH FILES
        !           274: .F /usr/tmp/stm???
        !           275: .SH SEE ALSO
        !           276: .IR comm (1),
        !           277: .IR join (1),
        !           278: .IR uniq (1),
        !           279: .IR look (1)
        !           280: .SH DIAGNOSTICS
        !           281: .I Sort
        !           282: comments and exits with non-zero status for various trouble
        !           283: conditions and for disorder discovered under option
        !           284: .BR -c .
        !           285: Overflow in a
        !           286: .B -a
        !           287: field warns and leaves
        !           288: the record uncombined.
        !           289: .SH BUGS
        !           290: When 
        !           291: .BR -o
        !           292: overwrites an input file,
        !           293: premature termination by interrupt,
        !           294: crash or file-system overflow can destroy data.
        !           295: .br
        !           296: Overflow in any but the first of multiple
        !           297: .B -a
        !           298: fields is fatal.
        !           299: .br
        !           300: Perhaps fields delimited by
        !           301: .BR -t
        !           302: should grow to avoid 
        !           303: .B -a
        !           304: overflows.

unix.superglobalmegacorp.com

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