shellLinux Shell 极简教程Shell

使用shell split切分文件

2018-10-22  本文已影响2人  风筝flying

简单明了,直接上命令

split -l 1000 test.txt -d -a 3 test_

-l:按行分隔,每1000行切割test.txt文件
-d:添加数字后缀
-a:以3位数数字做尾数
test_:分割后的文件的前缀

split -l 1000 test.txt -d -a 3 test_split_&&ls|grep test_split_ | xargs -n1 -i {} mv {} {}.txt

在基础版的结果上,先执行ls命令,查找test_split_开头的文件,然后逐个重命名为.txt

上一篇 下一篇

猜你喜欢

热点阅读