ranline - print lines selected at random


randline [-h | --no-filename] [-H | --with-filename] [--help] [--irs | --input-read-separator s] [-p | --percent pct] [-n | --pick number] [--seed number] [--version] [file]...


randline chooses lines at random from its input and outputs them. By default it picks one line from all the input files (or stdin if no files are specified). In all cases it does this using a single pass over the input, without saving the whole thing in memory.


-h, --no-filename

Never prepend the input file name to lines output. Normally it's output when there's more than one input file.

-H, --with-filename

Always output the input file name.


Show the usage message and die.

--irs, --input-read-separator s

Specify a different input record separator (really, terminator) (default newline).

-p, --percent pct

Choose pct percent of the input lines, rather than a fixed number.

-n, --pick number

Choose number lines from the input rather than 1.

--seed number

Use number as the seed for the random number generator. Normally you wouldn't want to specify this, instead you'd let the program pick the seed. The --seed switch is useful to achieve repeatability for debugging. If you use the same seed and other inputs randline will pick the same lines to output.


Show the version number and exit.


Roderick Schertler <>