2005-05-02 15:01:42 +02:00
|
|
|
.TH SORT 1
|
|
|
|
.SH NAME
|
|
|
|
sort \- sort a file of ASCII lines
|
|
|
|
.SH SYNOPSIS
|
|
|
|
\fBsort\fR [\fB\-bcdf\&imnru\fR]\fR [\fB\-t\fIc\fR] [\fB\-o \fIname\fR] [\fB+\fIpos1\fR] [\fB\-\fIpos2\fR] \fIfile\fR ...\fR
|
|
|
|
.br
|
|
|
|
.de FL
|
|
|
|
.TP
|
|
|
|
\\fB\\$1\\fR
|
|
|
|
\\$2
|
|
|
|
..
|
|
|
|
.de EX
|
|
|
|
.TP 20
|
|
|
|
\\fB\\$1\\fR
|
|
|
|
# \\$2
|
|
|
|
..
|
|
|
|
.SH OPTIONS
|
2012-03-31 23:44:29 +02:00
|
|
|
.TP 5
|
|
|
|
.B \-b
|
|
|
|
# Skip leading blanks when making comparisons
|
|
|
|
.TP 5
|
|
|
|
.B \-c
|
|
|
|
# Check to see if a file is sorted
|
|
|
|
.TP 5
|
|
|
|
.B \-d
|
|
|
|
# Dictionary order: ignore punctuation
|
|
|
|
.TP 5
|
|
|
|
.B \-f
|
|
|
|
# Fold upper case onto lower case
|
|
|
|
.TP 5
|
|
|
|
.B \-i
|
|
|
|
# Ignore nonASCII characters
|
|
|
|
.TP 5
|
|
|
|
.B \-m
|
|
|
|
# Merge presorted files
|
|
|
|
.TP 5
|
|
|
|
.B \-n
|
|
|
|
# Numeric sort order
|
|
|
|
.TP 5
|
|
|
|
.B \-o
|
|
|
|
# Next argument is output file
|
|
|
|
.TP 5
|
|
|
|
.B \-r
|
|
|
|
# Reverse the sort order
|
|
|
|
.TP 5
|
|
|
|
.B \-t
|
|
|
|
# Following character is field separator
|
|
|
|
.TP 5
|
|
|
|
.B \-u
|
|
|
|
# Unique mode (delete duplicate lines)
|
2005-05-02 15:01:42 +02:00
|
|
|
.SH EXAMPLES
|
2012-03-31 23:44:29 +02:00
|
|
|
.TP 20
|
|
|
|
.B sort \-nr file
|
|
|
|
# Sort keys numerically, reversed
|
|
|
|
.TP 20
|
|
|
|
.B sort +2 \-4 file
|
|
|
|
# Sort using fields 2 and 3 as key
|
|
|
|
.TP 20
|
|
|
|
.B sort +2 \-t: \-o out
|
|
|
|
# Field separator is \fI:\fP
|
|
|
|
.TP 20
|
|
|
|
.B sort +.3 \-.6
|
|
|
|
# Characters 3 through 5 form the key
|
2005-05-02 15:01:42 +02:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.PP
|
|
|
|
.I Sort
|
|
|
|
sorts one or more files.
|
|
|
|
If no files are specified, \fIstdin\fR is sorted.
|
|
|
|
Output is written on standard output, unless \fB\-o\fP is specified.
|
|
|
|
The options \fB+\fIpos1 \fB\-\fIpos2\fR use only fields \fIpos1\fR
|
|
|
|
up to but not including \fIpos2\fR 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 \fB\-t\fR.
|
|
|
|
Both \fIpos1\fR and \fIpos2\fR have the form \fIm.n\fR where \fIm\fR tells
|
|
|
|
the number of fields and \fIn\fR tells the number of characters.
|
|
|
|
Either \fIm\fR or \fIn\fR may be omitted.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR comm (1),
|
|
|
|
.BR grep (1),
|
|
|
|
.BR uniq (1).
|