发布于2022年11月4日2年前 有时会遇到文件比较大,无法查阅,需要切割才行; 命令参数: split [选项] [要切割的文件] [输出文件名前缀]1.首先查看文件大小ls -lh //目标文件 android@split:~/home/split$ ls -lh总用量 3.9G-rw-rw-r-- 1 android android 3.9G 1月 25 09:52 test.txt2.切割,他会以a,b,c方式生成文件,小于500m的放到最后一个文件;//行数切割 split -l 100 test.txt//指定分割文件的大小为500M split -b 500m test.txt log_主要说一下指定分割文件的大小500m方式;android@split:~/home/split$ split -b 500m test.txt log_//通过ls -lh查看,非常均匀;总用量 7.7G-rw-rw-r-- 1 android android 500M 1月 25 18:20 log_aa-rw-rw-r-- 1 android android 500M 1月 25 18:20 log_ab-rw-rw-r-- 1 android android 500M 1月 25 18:20 log_ac-rw-rw-r-- 1 android android 500M 1月 25 18:20 log_ad-rw-rw-r-- 1 android android 500M 1月 25 18:20 log_ae-rw-rw-r-- 1 android android 500M 1月 25 18:20 log_af-rw-rw-r-- 1 android android 500M 1月 25 18:20 log_ag-rw-rw-r-- 1 android android 442M 1月 25 18:20 log_ah-rw-rw-r-- 1 android android 3.9G 1月 25 09:52 test.txt3.组装文件,可以把自己想组装的文件进行组合;//如想把log_aa log_ab两个文件组合到一起,test1是新生成的文件,而非原有文件;android@split:~/home/split$ cat log_aa log_ab* > test1.text//通过ls -lh查看完全ok;总用量 1001M-rw-rw-r-- 1 android android 1000M 1月 25 18:26 test1.text如果想全部组装起来;//直接log_它会以a,b,c方式组合到一起;android@split:~/home/split$ cat log_* > test2.textandroid@split:~/home/split$ ls -lh test2.text -rw-rw-r-- 1 yuanjl yuanjl 1000M 1月 版权属于:逍遥子大表哥本文链接:https://blog.bbskali.cn/394.html按照知识共享署名-非商业性使用 4.0 国际协议进行许可,转载引用文章应遵循相同协议。
创建帐户或登录后发表意见