1SORT(1) User Commands SORT(1)
2
3
4
6 sort - sort lines of text files
7
9 sort [OPTION]... [FILE]...
10
12 Write sorted concatenation of all FILE(s) to standard output.
13
14 Mandatory arguments to long options are mandatory for short options
15 too. Ordering options:
16
17 -b, --ignore-leading-blanks
18 ignore leading blanks
19
20 -d, --dictionary-order
21 consider only blanks and alphanumeric characters
22
23 -f, --ignore-case
24 fold lower case to upper case characters
25
26 -g, --general-numeric-sort
27 compare according to general numerical value
28
29 -i, --ignore-nonprinting
30 consider only printable characters
31
32 -M, --month-sort
33 compare (unknown) < `JAN' < ... < `DEC'
34
35 -n, --numeric-sort
36 compare according to string numerical value
37
38 -R, --random-sort
39 sort by random hash of keys
40
41 --random-source=FILE
42 get random bytes from FILE (default /dev/urandom)
43
44 -r, --reverse
45 reverse the result of comparisons
46
47 Other options:
48
49 -c, --check, --check=diagnose-first
50 check for sorted input; do not sort
51
52 -C, --check=quiet, --check=silent
53 like -c, but do not report first bad line
54
55 --compress-program=PROG
56 compress temporaries with PROG; decompress them with PROG -d
57
58 -k, --key=POS1[,POS2]
59 start a key at POS1, end it at POS2 (origin 1)
60
61 -m, --merge
62 merge already sorted files; do not sort
63
64 -o, --output=FILE
65 write result to FILE instead of standard output
66
67 -s, --stable
68 stabilize sort by disabling last-resort comparison
69
70 -S, --buffer-size=SIZE
71 use SIZE for main memory buffer
72
73 -t, --field-separator=SEP
74 use SEP instead of non-blank to blank transition
75
76 -T, --temporary-directory=DIR
77 use DIR for temporaries, not $TMPDIR or /tmp; multiple options
78 specify multiple directories
79
80 -u, --unique
81 with -c, check for strict ordering; without -c, output only the
82 first of an equal run
83
84 -z, --zero-terminated
85 end lines with 0 byte, not newline
86
87 --help display this help and exit
88
89 --version
90 output version information and exit
91
92 POS is F[.C][OPTS], where F is the field number and C the character
93 position in the field; both are origin 1. If neither -t nor -b is in
94 effect, characters in a field are counted from the beginning of the
95 preceding whitespace. OPTS is one or more single-letter ordering
96 options, which override global ordering options for that key. If no
97 key is given, use the entire line as the key.
98
99 SIZE may be followed by the following multiplicative suffixes: % 1% of
100 memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.
101
102 With no FILE, or when FILE is -, read standard input.
103
104 *** WARNING *** The locale specified by the environment affects sort
105 order. Set LC_ALL=C to get the traditional sort order that uses native
106 byte values.
107
109 Written by Mike Haertel and Paul Eggert.
110
112 Report bugs to <bug-coreutils@gnu.org>.
113
115 Copyright © 2007 Free Software Foundation, Inc.
116 This is free software. You may redistribute copies of it under the
117 terms of the GNU General Public License
118 <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the
119 extent permitted by law.
120
122 The full documentation for sort is maintained as a Texinfo manual. If
123 the info and sort programs are properly installed at your site, the
124 command
125
126 info sort
127
128 should give you access to the complete manual.
129
130
131
132GNU coreutils 6.9 March 2008 SORT(1)