Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

shuf

Some strings on this page have not been translated yet. You can help by translating them on Weblate.
v(uutils coreutils) 0.8.0
shuf [OPCIÓN]... [ARCHIVO]
shuf -e [OPCIÓN]... [ARG]...
shuf -i LO-HI [OPCIÓN]...

Mezclar la entrada mostrando una permutación aleatoria de líneas de entrada. Cada permutación de salida es igualmente probable. Sin ARCHIVO, o cuando ARCHIVO es -, leer entrada estándar.

Options

--echo, -e

tratar cada ARG como una línea de entrada

--input-range=<LO-HI>, -i <LO-HI>

tratar cada número LO hasta HI como una línea de entrada

--head-count=<COUNT>, -n <COUNT>

mostrar como máximo CONTEO líneas

--output=<FILE>, -o <FILE>

escribir resultado a ARCHIVO en lugar de salida estándar

--random-seed=<STRING>

seed with STRING for reproducible output

--random-source=<FILE>

obtener bytes aleatorios de ARCHIVO

--repeat, -r

las líneas de salida pueden ser repetidas

--zero-terminated, -z

el delimitador de línea es NUL, no nueva línea

Examples

Randomize the order of lines in a file and output the result:

shuf {{path/to/file}}

Only output the first 5 entries of the result:

shuf {{[-n|--head-count]}} 5 {{path/to/file}}

Write the output to another file:

shuf {{path/to/input_file}} {{[-o|--output]}} {{path/to/output_file}}

Generate 3 random numbers in the range 1-10 (inclusive, numbers can repeat):

shuf {{[-n|--head-count]}} 3 {{[-i|--input-range]}} 1-10 {{[-r|--repeat]}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.