summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2022-09-30 15:44:30 +0100
committerPádraig Brady <P@draigBrady.com>2022-09-30 15:44:30 +0100
commit4fd708810ce0e0d967c4c14e1ff2ff7b43440b58 (patch)
tree496408d5f96c4b7e3936cf0055cf58dbc747c643
parent339fb6bb842e39b5bcca4a7473d0781c4d3b80e6 (diff)
downloadcoreutils-4fd708810ce0e0d967c4c14e1ff2ff7b43440b58.tar.gz
coreutils-4fd708810ce0e0d967c4c14e1ff2ff7b43440b58.zip
doc: sort: mention --version useful for IPv4 addresses
* doc/coreutils.texi (sort invocation): Mention in the multi invocation sort example that the -V GNU extension could be used to sort IPv4 addresses, and thus simplify to a single invocation.
-rw-r--r--doc/coreutils.texi6
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 471c50e8c..3328cd899 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -4971,7 +4971,7 @@ sort -s -t ' ' -k 4.9n -k 4.5M -k 4.2n -k 4.14,4.21 file*.log |
sort -s -t '.' -k 1,1n -k 2,2n -k 3,3n -k 4,4n
@end example
-This example cannot be done with a single @command{sort} invocation,
+This example cannot be done with a single POSIX @command{sort} invocation,
since IPv4 address components are separated by @samp{.} while dates
come just after a space. So it is broken down into two invocations of
@command{sort}: the first sorts by timestamp and the second by IPv4
@@ -4983,7 +4983,9 @@ based on leading prefixes that cannot cross field boundaries. The
IPv4 addresses are sorted lexicographically. The second sort uses
@samp{-s} so that ties in the primary key are broken by the secondary
key; the first sort uses @samp{-s} so that the combination of the two
-sorts is stable.
+sorts is stable. Note as a GNU extension, the above example could
+be achieved in a single @command{sort} invocation by sorting the
+IPv4 address field using a @samp{V} version type, like @samp{-k1,1V}.
@item
Generate a tags file in case-insensitive sorted order.