summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-09-08 19:29:18 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-09-08 19:29:18 +0000
commit55fe28e3e9d00ec1324ac2df0ac17b391d4a82b9 (patch)
tree4f58a53f81c10ad20103dac83da7bdc00272f18f
parentec7650c027ed0018aca119e075248cca70faed9c (diff)
downloadcoreutils-55fe28e3e9d00ec1324ac2df0ac17b391d4a82b9.tar.xz
(sort invocation): Add remarks about sort -u versus sort | uniq.
Prompted by a question from Andrew Noymer.
-rw-r--r--doc/coreutils.texi9
1 files changed, 8 insertions, 1 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 9a50178cb..a71a3fe39 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3353,7 +3353,7 @@ line as the key and acts as if no ordering options were specified.
But if @option{--reverse} (@option{-r}) was specified along with other
ordering options, then the last-resort comparison does use @option{--reverse}.
In any case, when no ordering option is specified or when only
-@option{--reverse} is specified, the last-resort comparison is not performed
+@option{--reverse} is specified, the last-resort comparison is not performed.
@item -S @var{size}
@itemx --buffer-size=@var{size}
@@ -3419,6 +3419,12 @@ Normally, output only the first of a sequence of lines that compare
equal. For the @option{--check} (@option{-c}) option,
check that no pair of consecutive lines compares equal.
+The commands @code{sort -u} and @code{sort | uniq} are equivalent, but
+this equivalence does not extend to arbitrary @command{sort} options.
+For example, @code{sort -n -u} inspects only the value of the initial
+numeric string when checking for uniqueness, whereas @code{sort -n |
+uniq} inspects the entire line. @xref{uniq invocation}.
+
@item -z
@itemx --zero-terminated
@opindex -z
@@ -3618,6 +3624,7 @@ lines that are not repeated, or all repeated lines.
The input need not be sorted, but repeated input lines are detected
only if they are adjacent. If you want to discard non-adjacent
duplicate lines, perhaps you want to use @code{sort -u}.
+@xref{sort invocation}.
@vindex LC_COLLATE
Comparisons use the character collating sequence specified by the