shuf命令的安裝
shuf 命令是 coreutils 包中的命令,可以使用 yum 或者 brew 工具下載
yum install coreutils
or
brew install coreutils
配置
如果你想要終端的任何路徑下直接使用 shuf嫂侍,還需要在bashrc文件配置下
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
使用
1.將文件A的順序打亂儿捧,并輸出到文件B
shuf a.txt -o b.txt
2.查看文件內(nèi)容
cat xx.txt