1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/shuf.md

21 lines
489 B
Markdown
Raw Normal View History

2014-09-08 13:27:44 +04:00
# shuf
> Generate random permutations.
> More information: <https://www.gnu.org/software/coreutils/shuf>.
2014-09-08 13:27:44 +04:00
- Randomize the order of lines in a file and output the result:
2014-09-08 13:27:44 +04:00
`shuf {{filename}}`
- Only output the first 5 entries of the result:
2014-09-08 13:27:44 +04:00
`shuf --head-count={{5}} {{filename}}`
2014-09-08 13:27:44 +04:00
- Write the output to another file:
2014-09-08 13:27:44 +04:00
`shuf {{filename}} --output={{output_filename}}`
2014-09-10 17:58:31 +04:00
- Generate 3 random numbers in the range 1-10 (inclusive):
2014-09-10 17:58:31 +04:00
`shuf --head-count={{3}} --input-range={{1-10}} --repeat`