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 [OPTION]... [FICHIER]
shuf -e [OPTION]... [ARG]...
shuf -i MIN-MAX [OPTION]...

Mélanger l’entrée en affichant une permutation aléatoire des lignes d’entrée. Chaque permutation de sortie est également probable. Sans FICHIER, ou quand FICHIER est -, lire l’entrée standard.

Options

--echo, -e

traiter chaque ARG comme une ligne d’entrée

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

traiter chaque nombre de MIN à MAX comme une ligne d’entrée

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

afficher au maximum NOMBRE lignes

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

écrire le résultat dans FICHIER au lieu de la sortie standard

--random-seed=<STRING>

seed with STRING for reproducible output

--random-source=<FILE>

obtenir des octets aléatoires depuis FICHIER

--repeat, -r

les lignes de sortie peuvent être répétées

--zero-terminated, -z

le délimiteur de ligne est NUL, pas nouvelle ligne

Examples

The examples have not been translated yet and are shown in English. You can help by translating them on tldr-pages.

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.