2016-02-17 03:42:46 -05:00
|
|
|
.Dd 2016-02-17
|
2015-01-31 08:20:02 -05:00
|
|
|
.Dt SORT 1
|
2015-01-31 14:37:03 -05:00
|
|
|
.Os sbase
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sh NAME
|
|
|
|
.Nm sort
|
|
|
|
.Nd sort lines
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2016-02-15 19:42:25 -05:00
|
|
|
.Op Fl Cbcdfimnru
|
2015-03-22 18:37:37 -04:00
|
|
|
.Op Fl o Ar outfile
|
2015-01-30 17:49:13 -05:00
|
|
|
.Op Fl t Ar delim
|
|
|
|
.Op Fl k Ar key ...
|
|
|
|
.Op Ar file ...
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
2015-03-22 18:37:37 -04:00
|
|
|
writes the sorted concatenation of each
|
|
|
|
.Ar file
|
|
|
|
to stdout.
|
|
|
|
If no
|
2015-02-01 14:52:28 -05:00
|
|
|
.Ar file
|
2015-03-22 18:37:37 -04:00
|
|
|
is given
|
2015-02-01 14:52:28 -05:00
|
|
|
.Nm
|
|
|
|
reads from stdin.
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl C
|
2015-02-01 14:52:28 -05:00
|
|
|
Check that the concatenation of the given
|
|
|
|
.Ar files
|
2020-03-01 17:37:31 -05:00
|
|
|
is sorted rather than sorting them.
|
|
|
|
In this mode, no output is printed to stdout, and the exit status
|
|
|
|
indicates the result of the check.
|
2015-01-30 17:49:13 -05:00
|
|
|
.It Fl b
|
2015-02-01 14:52:28 -05:00
|
|
|
Skip leading whitespace of columns when sorting.
|
2015-01-30 17:49:13 -05:00
|
|
|
.It Fl c
|
2015-02-01 14:52:28 -05:00
|
|
|
The same as
|
2015-01-30 17:49:13 -05:00
|
|
|
.Fl C
|
2015-03-22 18:37:37 -04:00
|
|
|
except that when disorder is detected, a message is written to stderr
|
2014-11-23 14:35:56 -05:00
|
|
|
indicating the location of the disorder.
|
2016-02-15 19:42:25 -05:00
|
|
|
.It Fl d
|
|
|
|
Skip non-whitespace and non-alphanumeric characters.
|
|
|
|
.It Fl f
|
|
|
|
Ignore letter case when sorting.
|
|
|
|
.It FL i
|
|
|
|
Skip non-printable characters.
|
2015-01-30 17:49:13 -05:00
|
|
|
.It Fl k Ar key
|
2015-03-22 18:37:37 -04:00
|
|
|
Specify a key definition of the form
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sm off
|
2015-02-01 11:45:51 -05:00
|
|
|
.Sy S
|
|
|
|
.No [.
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy s
|
2015-02-01 11:45:51 -05:00
|
|
|
.No ][
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy f
|
2015-02-01 11:45:51 -05:00
|
|
|
.No ][,
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy E
|
2015-02-01 11:45:51 -05:00
|
|
|
.No [.
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy e
|
2015-02-01 11:45:51 -05:00
|
|
|
.No ][
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy f
|
2015-02-01 11:45:51 -05:00
|
|
|
.No ]]
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sm on
|
2014-04-12 11:53:10 -04:00
|
|
|
where
|
2015-02-01 15:45:35 -05:00
|
|
|
.Sy S , s , E
|
2014-04-12 11:53:10 -04:00
|
|
|
and
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy e
|
2014-04-12 11:53:10 -04:00
|
|
|
are the starting column, starting character in that column, ending column and
|
2020-03-01 17:37:31 -05:00
|
|
|
the ending character of that column respectively.
|
|
|
|
If they are not specified,
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy s
|
2014-05-06 10:07:05 -04:00
|
|
|
refers to the first character of the specified starting column,
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy E
|
2014-05-06 10:07:05 -04:00
|
|
|
refers to the last column of every line, and
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy e
|
2015-02-01 11:45:51 -05:00
|
|
|
refers to the last character of the ending column.
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy f
|
2014-05-06 10:07:05 -04:00
|
|
|
can be used to specify options
|
2015-02-01 15:45:35 -05:00
|
|
|
.Sy ( n , b )
|
2014-05-06 10:07:05 -04:00
|
|
|
that only apply to this key definition.
|
2015-01-30 17:49:13 -05:00
|
|
|
.Sy b
|
2014-05-06 10:07:05 -04:00
|
|
|
is special in that it only applies to the column that it was specified after.
|
2015-03-22 18:37:37 -04:00
|
|
|
.It Fl m
|
|
|
|
Assume sorted input, merge only.
|
2015-01-30 17:49:13 -05:00
|
|
|
.It Fl n
|
2015-02-01 14:52:28 -05:00
|
|
|
Perform a numeric sort.
|
2015-03-22 18:37:37 -04:00
|
|
|
.It Fl o Ar outfile
|
|
|
|
Write output to
|
|
|
|
.Ar outfile
|
|
|
|
rather than stdout.
|
2015-01-30 17:49:13 -05:00
|
|
|
.It Fl r
|
2015-02-01 14:52:28 -05:00
|
|
|
Reverses the sort.
|
2015-01-30 17:49:13 -05:00
|
|
|
.It Fl t Ar delim
|
2015-03-22 18:37:37 -04:00
|
|
|
Set
|
|
|
|
.Ar delim
|
|
|
|
as the field delimiter.
|
2015-01-30 17:49:13 -05:00
|
|
|
.It Fl u
|
2015-03-22 18:37:37 -04:00
|
|
|
Print equal lines only once.
|
2015-01-30 17:49:13 -05:00
|
|
|
.El
|
2016-02-17 03:38:27 -05:00
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is compliant with the
|
|
|
|
.St -p1003.1-2013
|
|
|
|
specification.
|