summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-06-01 11:56:47 +0100
committerPádraig Brady <P@draigBrady.com>2016-06-01 11:56:47 +0100
commita3311c966e34f2d9f8aa6b1de31b211124803d02 (patch)
tree19259a8d94c4bcb85ab9e404e1705df8d69280ef /doc
parent6223bf94bfeac75fb4252095864a80545ba00a0d (diff)
downloadcoreutils-a3311c966e34f2d9f8aa6b1de31b211124803d02.tar.xz
doc: clarify sort --key handling of default field separators
* doc/coreutils.texi (sort invocation): Mention in the summary dicussion that --key is used to specify fields. Give a summary in the --key description, of the most common use case of specifying a field, and that by default those fields include the blank separators at the start of each field in the comparisons.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi11
1 files changed, 9 insertions, 2 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 6a671bb8e..47c63db79 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -4022,7 +4022,7 @@ sort [@var{option}]@dots{} [@var{file}]@dots{}
Many options affect how @command{sort} compares lines; if the results
are unexpected, try the @option{--debug} option to see what happened.
A pair of lines is compared as follows:
-@command{sort} compares each pair of fields, in the
+@command{sort} compares each pair of fields (see @option{--key}), in the
order specified on the command line, according to the associated
ordering options, until a difference is found or no fields are left.
If no key fields are specified, @command{sort} uses a default key of
@@ -4332,7 +4332,14 @@ Specify a sort field that consists of the part of the line between
@var{pos1} and @var{pos2} (or the end of the line, if @var{pos2} is
omitted), @emph{inclusive}.
-Each @var{pos} has the form @samp{@var{f}[.@var{c}][@var{opts}]},
+In its simplest form @var{pos} specifies a field number (starting with 1),
+with fields being separated by runs of blank characters, and by default
+those blanks being included in the comparison at the start of each field.
+To adjust the handling of blank characters see the @option{-b} and
+@option{-t} options.
+
+More generally,
+each @var{pos} has the form @samp{@var{f}[.@var{c}][@var{opts}]},
where @var{f} is the number of the field to use, and @var{c} is the number
of the first character from the beginning of the field. Fields and character
positions are numbered starting with 1; a character position of zero in