Files
tldr/pages.zh/common/shuf.md

20 lines
459 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# shuf
> 生成随机排列。
> 更多信息: <https://www.gnu.org/software/coreutils/shuf>。
- 随机化文件中行的顺序并输出结果:
`shuf {{path/to/file}}`
- 仅输出结果的前5个条目
`shuf --head-count=5 {{path/to/file}}`
- 将输出写入另一个文件:
`shuf {{path/to/input_file}} --output={{path/to/output_file}}`
- 在1-10包含范围内生成3个随机数
`shuf --head-count=3 --input-range=1-10 --repeat`