sort: add -k, fix -u

Options  that are  specific to  a  single  key  definition are not
supported (e.g. "sort -k 2,3n -k 4,4").  Should you try to specify
such definitions, sort will  return with EXIT_FAILURE and an error
message.   Instead, all key definitions exclusively use the global
settings.

It always behaves like -b was set.
This commit is contained in:
Jakob Kramer
2014-04-12 17:53:10 +02:00
committed by sin
parent 02d91696b4
commit 98a12cc146
2 changed files with 178 additions and 14 deletions

19
sort.1
View File

@@ -4,6 +4,9 @@ sort \- sort lines
.SH SYNOPSIS
.B sort
.RB [ \-nru ]
.RB [ \-k
.I key
.R ]...
.RI [ file ...]
.SH DESCRIPTION
.B sort
@@ -18,4 +21,18 @@ perform a numeric sort.
reverses the sort.
.TP
.B \-u
prints repeated lines only once.
prints equal lines only once.
.TP
.B \-k key
specifies a key definition of the form \fBS\fR[.\fBs\fR][,\fBE\fR[.\fBe\fR]],
where
.B S,
.B s,
.B E,
and
.B e
are the starting column, starting character in that column, ending column and
the ending character of that column respectively. If they are not specified,
s refers to the first character of the specified starting column, E refers to
the last column of every line, and e refers to the last character of that last
column.