]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
sort: improve --help
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 29 Sep 2023 01:02:25 +0000 (18:02 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 29 Sep 2023 01:03:34 +0000 (18:03 -0700)
Problem reported by Jorge Stolfi (bug#66253).
* src/sort.c (usage): Suggest looking at the manual for -n details.

doc/coreutils.texi
src/sort.c

index ee3b1ce11a1650168a6ec2ff685cfb19f162cd77..be4b610be8d6b66f3779f445fcfb0c425fc77610 100644 (file)
@@ -4678,18 +4678,22 @@ can change this.
 @opindex --numeric-sort
 @opindex --sort
 @cindex numeric sort
+@vindex LC_CTYPE
 @vindex LC_NUMERIC
 Sort numerically.  The number begins each line and consists
 of optional blanks, an optional @samp{-} sign, and zero or more
 digits possibly separated by thousands separators, optionally followed
 by a decimal-point character and zero or more digits.  An empty
-number is treated as @samp{0}.  The @env{LC_NUMERIC}
-locale specifies the decimal-point character and thousands separator.
-By default a blank is a space or a tab, but the @env{LC_CTYPE} locale
-can change this.
+number is treated as @samp{0}.  Signs on zeros and leading zeros do
+not affect ordering.
 
 Comparison is exact; there is no rounding error.
 
+The @env{LC_CTYPE} locale specifies which characters are blanks and
+the @env{LC_NUMERIC} locale specifies the thousands separator and
+decimal-point character.  In the C locale, spaces and tabs are blanks,
+there is no thousands separator, and @samp{.} is the decimal point.
+
 Neither a leading @samp{+} nor exponential notation is recognized.
 To compare such strings numerically, use the
 @option{--general-numeric-sort} (@option{-g}) option.
index abee57d7a071271b00f3f4144409d102a62af072..5c86b83324cc1d0839f0c4f11b494f49b9d44071 100644 (file)
@@ -444,7 +444,8 @@ Ordering options:\n\
   -h, --human-numeric-sort    compare human readable numbers (e.g., 2K 1G)\n\
 "), stdout);
       fputs (_("\
-  -n, --numeric-sort          compare according to string numerical value\n\
+  -n, --numeric-sort          compare according to string numerical value;\n\
+                                see manual for which strings are supported\n\
   -R, --random-sort           shuffle, but group identical keys.  See shuf(1)\n\
       --random-source=FILE    get random bytes from FILE\n\
   -r, --reverse               reverse the result of comparisons\n\