tldr/pages/common/shuf.md

21 lines
444 B
Markdown
Raw Normal View History

2014-09-08 10:27:44 +01:00
# shuf
> Generate random permutations.
2021-03-30 14:56:33 +01:00
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/shuf-invocation.html>.
2014-09-08 10:27:44 +01:00
- Randomize the order of lines in a file and output the result:
2014-09-08 10:27:44 +01:00
`shuf {{filename}}`
- Only output the first 5 entries of the result:
2014-09-08 10:27:44 +01:00
`shuf -n {{5}} {{filename}}`
2014-09-08 10:27:44 +01:00
- Write the output to another file:
2014-09-08 10:27:44 +01:00
`shuf {{filename}} -o {{output_filename}}`
2014-09-10 14:58:31 +01:00
- Generate random numbers in range:
2014-09-10 14:58:31 +01:00
`shuf -i {{1-10}}`