1 | .TH SORT 1
|
---|
2 | .SH NAME
|
---|
3 | sort \- sort a file of ASCII lines
|
---|
4 | .SH SYNOPSIS
|
---|
5 | \fBsort\fR [\fB\-bcdf\&imnru\fR]\fR [\fB\-t\fIc\fR] [\fB\-o \fIname\fR] [\fB+\fIpos1\fR] [\fB\-\fIpos2\fR] \fIfile\fR ...\fR
|
---|
6 | .br
|
---|
7 | .de FL
|
---|
8 | .TP
|
---|
9 | \\fB\\$1\\fR
|
---|
10 | \\$2
|
---|
11 | ..
|
---|
12 | .de EX
|
---|
13 | .TP 20
|
---|
14 | \\fB\\$1\\fR
|
---|
15 | # \\$2
|
---|
16 | ..
|
---|
17 | .SH OPTIONS
|
---|
18 | .FL "\-b" "Skip leading blanks when making comparisons"
|
---|
19 | .FL "\-c" "Check to see if a file is sorted"
|
---|
20 | .FL "\-d" "Dictionary order: ignore punctuation"
|
---|
21 | .FL "\-f" "Fold upper case onto lower case"
|
---|
22 | .FL "\-i" "Ignore nonASCII characters"
|
---|
23 | .FL "\-m" "Merge presorted files"
|
---|
24 | .FL "\-n" "Numeric sort order"
|
---|
25 | .FL "\-o" "Next argument is output file"
|
---|
26 | .FL "\-r" "Reverse the sort order"
|
---|
27 | .FL "\-t" "Following character is field separator"
|
---|
28 | .FL "\-u" "Unique mode (delete duplicate lines)"
|
---|
29 | .SH EXAMPLES
|
---|
30 | .EX "sort \-nr file" "Sort keys numerically, reversed"
|
---|
31 | .EX "sort +2 \-4 file" "Sort using fields 2 and 3 as key"
|
---|
32 | .EX "sort +2 \-t: \-o out" "Field separator is \fI:\fP"
|
---|
33 | .EX "sort +.3 \-.6" "Characters 3 through 5 form the key"
|
---|
34 | .SH DESCRIPTION
|
---|
35 | .PP
|
---|
36 | .I Sort
|
---|
37 | sorts one or more files.
|
---|
38 | If no files are specified, \fIstdin\fR is sorted.
|
---|
39 | Output is written on standard output, unless \fB\-o\fP is specified.
|
---|
40 | The options \fB+\fIpos1 \fB\-\fIpos2\fR use only fields \fIpos1\fR
|
---|
41 | up to but not including \fIpos2\fR as the sort key, where a field is a
|
---|
42 | string of characters delimited by spaces and tabs, unless a different field
|
---|
43 | delimiter is specified with \fB\-t\fR.
|
---|
44 | Both \fIpos1\fR and \fIpos2\fR have the form \fIm.n\fR where \fIm\fR tells
|
---|
45 | the number of fields and \fIn\fR tells the number of characters.
|
---|
46 | Either \fIm\fR or \fIn\fR may be omitted.
|
---|
47 | .SH "SEE ALSO"
|
---|
48 | .BR comm (1),
|
---|
49 | .BR grep (1),
|
---|
50 | .BR uniq (1).
|
---|