2015-01-30 22:49:13 +00:00
|
|
|
.Dd January 30, 2015
|
2015-01-31 13:20:02 +00:00
|
|
|
.Dt SORT 1
|
2015-01-31 19:37:03 +00:00
|
|
|
.Os sbase
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm sort
|
|
|
|
.Nd sort lines
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Op Fl bnru
|
|
|
|
.Op Fl t Ar delim
|
|
|
|
.Op Fl k Ar key ...
|
|
|
|
.Op Ar file ...
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
|
|
|
writes the sorted concatenation of the given files to stdout. If no file is
|
2011-06-02 12:03:34 +00:00
|
|
|
given, sort reads from stdin.
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl C
|
2014-11-23 19:35:56 +00:00
|
|
|
check that the concatenation of the given files is sorted rather than sorting
|
2015-01-30 22:49:13 +00:00
|
|
|
them. In this mode, no output is printed to stdout, and the exit status
|
2014-11-23 19:35:56 +00:00
|
|
|
indicates the result of the check.
|
2015-01-30 22:49:13 +00:00
|
|
|
.It Fl b
|
2014-05-03 18:42:33 +00:00
|
|
|
skip leading whitespace of columns when sorting.
|
2015-01-30 22:49:13 +00:00
|
|
|
.It Fl c
|
2014-11-23 19:35:56 +00:00
|
|
|
the same as
|
2015-01-30 22:49:13 +00:00
|
|
|
.Fl C
|
2014-11-23 19:35:56 +00:00
|
|
|
except that when disorder is detected, a message is printed to stderr
|
|
|
|
indicating the location of the disorder.
|
2015-01-30 22:49:13 +00:00
|
|
|
.It Fl k Ar key
|
2014-05-06 14:07:05 +00:00
|
|
|
specifies a key definition of the form
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sm off
|
|
|
|
[.
|
|
|
|
.Sy s
|
|
|
|
][
|
|
|
|
.Sy f
|
|
|
|
][,
|
|
|
|
.Sy E
|
|
|
|
[.
|
|
|
|
.Sy e
|
|
|
|
][
|
|
|
|
.Sy f
|
|
|
|
]]
|
|
|
|
.Sm on
|
2014-04-12 15:53:10 +00:00
|
|
|
where
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sm off
|
|
|
|
.Sy S
|
|
|
|
,
|
|
|
|
.Sy s
|
|
|
|
,
|
|
|
|
.Sy E
|
|
|
|
.Sm on
|
2014-04-12 15:53:10 +00:00
|
|
|
and
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sy e
|
2014-04-12 15:53:10 +00:00
|
|
|
are the starting column, starting character in that column, ending column and
|
2015-01-30 22:49:13 +00:00
|
|
|
the ending character of that column respectively. If they are not specified,
|
|
|
|
.Sy s
|
2014-05-06 14:07:05 +00:00
|
|
|
refers to the first character of the specified starting column,
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sy E
|
2014-05-06 14:07:05 +00:00
|
|
|
refers to the last column of every line, and
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sy e
|
2014-05-06 14:07:05 +00:00
|
|
|
refers to the last character of that last column.
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sy f
|
2014-05-06 14:07:05 +00:00
|
|
|
can be used to specify options
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sm off
|
|
|
|
(
|
|
|
|
.Sy n
|
|
|
|
,
|
|
|
|
.Sy b
|
|
|
|
)
|
|
|
|
.Sm on
|
2014-05-06 14:07:05 +00:00
|
|
|
that only apply to this key definition.
|
2015-01-30 22:49:13 +00:00
|
|
|
.Sy b
|
2014-05-06 14:07:05 +00:00
|
|
|
is special in that it only applies to the column that it was specified after.
|
2015-01-30 22:49:13 +00:00
|
|
|
.It Fl n
|
2014-05-15 18:08:17 +00:00
|
|
|
perform a numeric sort.
|
2015-01-30 22:49:13 +00:00
|
|
|
.It Fl r
|
2014-05-15 18:08:17 +00:00
|
|
|
reverses the sort.
|
2015-01-30 22:49:13 +00:00
|
|
|
.It Fl t Ar delim
|
2014-05-15 18:08:17 +00:00
|
|
|
specifies the field delimiter.
|
2015-01-30 22:49:13 +00:00
|
|
|
.It Fl u
|
2014-05-15 18:08:17 +00:00
|
|
|
prints equal lines only once.
|
2015-01-30 22:49:13 +00:00
|
|
|
.El
|