NAME
shuf —
shuffle lines
SYNOPSIS
shuf |
[-rz] [-n
limit] [-o
out-file]
[--random-source=rand-file]
[file]… |
shuf |
-e [-rz]
[-n limit]
[-o out-file]
[--random-source=rand-file]
[line]… |
shuf |
-i
from-to
[-rz] [-n
limit] [-o
out-file]
[--random-source=rand-file] |
DESCRIPTION
Shuffles all lines, then writes up to
limit of them to the standard output stream (or
out-file, if specified). With
-r, writes random lines until
limit (for-ever default).
By default, lines originate from
files (or standard input stream if
"-", the default).
With -e, lines are the
non-option arguments.
With -i, lines are all integers
in [from, to].
OPTIONS
-e,--echo- Use arguments as lines.
-i,--input-range=from-to- Use [from, to] as lines.
-r,--repeat- Continuously randomly sample lines instead of writing a single unique permutation.
-z,--zero-terminated- Separate input and output lines with a NUL instead of newline.
-n,--head-count=limit- Write up to limit lines.
-o,--output=out-file- Write to out-file instead of the standard output stream.
--random-source=rand-file- Use randomness from rand-file as the seed. Defaults to an equivalent of /dev/urandom.
EXIT STATUS
1 if a file couldn't be opened, read, or written.
STANDARDS
Originates from the GNU system, also present in FreeBSD. Multiple files are an extension.