tldr/pages/linux/shuf.md

20 lines
349 B
Markdown
Raw Normal View History

2014-09-08 10:27:44 +01:00
# shuf
> Generate random permutations.
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 n entries of the result:
2014-09-08 10:27:44 +01:00
`shuf -n {{n}} {{filename}}`
- Write output to another file:
2014-09-08 10:27:44 +01:00
`shuf -o {{another_filename}} {{filename}}`
2014-09-10 14:58:31 +01:00
- Generate random numbers in range:
2014-09-10 14:58:31 +01:00
`shuf -i {{low}}-{{high}}`