The Shuf command can randomly extract different lines of a text file, output to a file or standard output.
Shuf usage: Shuf [options] ... [File] or: Shuf-e [Options] ... [Parameters] ... Or: Shuf-I. lo-HI [Options] ... Write a random permutation of the input lines to standard output. If no file is specified, or if the file is"-", it is read from the standard input. The required parameters are available for both long and long options. -E,--Echotreat each ARG as a input line-I.,--input-range=lo-hi treat each number LO through HI as a input line-N,--Head-count=count output at the most count lines-O,--output=fileWriteresult to FILE instead of the standard output--random-source=file get random bytes from file-R,--repeat output lines can be repeated-Z,--zero-terminated line delimiter are NUL, not newline--Help displays this information and exits--version display version information and exit
Example: Extracting a random 20 row from a Input.txt
-O output.txt
"Shell" Shuf command extracts random rows of a file