66 lines
1.6 KiB
Plaintext
66 lines
1.6 KiB
Plaintext
|
|
|
|
|
|
|
|
|
|
Command: sort - sort a file of ASCII lines
|
|
Syntax: sort [-bcdfimnru] [-tc] [-o name] [+pos1] [-pos2] file ...
|
|
Flags: -b Skip leading blanks when making comparisons
|
|
-c Check to see if a file is sorted
|
|
-d Dictionary order: ignore punctuation
|
|
-f Fold upper case onto lower case
|
|
-i Ignore nonASCII characters
|
|
-m Merge presorted files
|
|
-n Numeric sort order
|
|
-o Next argument is output file
|
|
-r Reverse the sort order
|
|
-t Following character is field separator
|
|
-u Unique mode (delete duplicate lines)
|
|
Examples: sort -nr file # Sort keys numerically, reversed
|
|
sort +2 -4 file # Sort using fields 2 and 3 as key
|
|
sort +2 -t: -o out # Field separator is :
|
|
sort +.3 -.6 # Characters 3 through 5 form the
|
|
key
|
|
|
|
Sort sorts one or more files. If no files are specified, stdin is
|
|
sorted. Output is written on standard output, unless -o is specified.
|
|
The options +pos1 -pos2 use only fields pos1 up to but not including
|
|
pos2 as the sort key, where a field is a string of characters delimited
|
|
by spaces and tabs, unless a different field delimiter is specified with
|
|
-t. Both pos1 and pos2 have the form m.n where m tells the number of
|
|
fields and n tells the number of characters. Either m or n may be
|
|
omitted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|