summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-12-10 08:10:20 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-12-10 08:10:20 +0000
commite076a7785103d56f72202b89cd4a60aaad86d59e (patch)
tree2912dffa384108df2901186ffdfca7f58adc3451 /doc
parent569c4876bc3124ffd1abea28e2c869bc5e63e74b (diff)
downloadcoreutils-e076a7785103d56f72202b89cd4a60aaad86d59e.tar.xz
(sort invocation): Add --random-sort (-R) and --seed.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 41f56d5b4..a7f59c513 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3396,6 +3396,15 @@ To compare such strings numerically, use the
Reverse the result of comparison, so that lines with greater key values
appear earlier in the output instead of later.
+@item -R
+@itemx --random-sort
+@opindex -R
+@opindex --random-sort
+@cindex random sort
+
+Sort by random hash, i.e. perform a shuffle. This is done by hashing
+the input keys and sorting based on the results.
+
@end table
Other options are:
@@ -3529,6 +3538,11 @@ This option can be useful in conjunction with @samp{perl -0} or
reliably handle arbitrary file names (even those containing blanks
or other special characters).
+@itemx --seed @var{tempdir}
+@opindex --seed
+@cindex specify seed for random hash
+Specify a seed for the @option{--random-sort} option.
+
@end table
Historical (BSD and System V) implementations of @command{sort} have
@@ -3695,6 +3709,16 @@ by the sort operation.
@c printf 'c\n\nb\n\na\n'|perl -0pe 's/\n\n/\n\0/g'|sort -z|perl -0pe 's/\0/\n/g'
@c @end example
+@item
+Shuffle a list of directories, but preserve the order of files within
+each directory. For instance, one could use this to generate a music
+playlist in which albums are shuffled but the songs of each album are
+played in order.
+
+@example
+find . -maxdepth 2 -type f | sort -t / -k2,2R -k3,3
+@end example
+
@end itemize