2025-03-14 21:59:59 -06:00
|
|
|
# shuf
|
|
|
|
|
|
|
|
|
|
> Generate random permutations.
|
|
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/shuf-invocation.html>.
|
|
|
|
|
|
|
|
|
|
- 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:
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`shuf {{[-n|--head-count]}} 5 {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Write the output to another file:
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`shuf {{path/to/input_file}} {{[-o|--output]}} {{path/to/output_file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Generate 3 random numbers in the range 1-10 (inclusive):
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`shuf {{[-n|--head-count]}} 3 {{[-i|--input-range]}} 1-10 {{[-r|--repeat]}}`
|