linux 命令shuf
1 shuf --help 2 用法: shuf [选项]... [文件] 3 或者: shuf -e [选项]... [参数]... 4 或者: shuf -i LO-HI [选项]... 5 Write a random permutation of the input lines to standard output. 6 7 如果没有指定文件,或者文件为"-",则从标准输入读取。 8 9 必选参数对长短选项同时适用。 10 -e, --echo treat each ARG as an input line 11 -i, --input-range=LO-HI treat each number LO through HI as an input line 12 -n, --head-count=COUNT output at most COUNT lines 13 -o, --output=FILE write result to FILE instead of standard output 14 --random-source=FILE get random bytes from FILE 15 -r, --repeat output lines can be repeated 16 -z, --zero-terminated line delimiter is NUL, not newline 17 --help 显示此帮助信息并退出 18 --version 显示版本信息并退出 19 20 GNU coreutils online help: <http://www.gnu.org/software/coreutils/> 21 请向<http://translationproject.org/team/zh_CN.html> 报告shuf 的翻译错误 22 Full documentation at: <http://www.gnu.org/software/coreutils/shuf> 23 or available locally via: info '(coreutils) shuf invocation'
ps:
shuf train.txt -o test.txt -n 30
从train.txt文件中随机读取30行文本输出到test.txt