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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM