ubuntu split命令文件切割

29 篇文章 1 订阅
22 篇文章 1 订阅

笔记一下常用的几个;

有时会遇到文件比较大,无法查阅,需要切割才行;
命令参数:
split [选项] [要切割的文件] [输出文件名前缀]

1.首先查看文件大小

 ls -lh
 //目标文件
 android@split:~/home/split$ ls -lh
总用量 3.9G
-rw-rw-r-- 1 android android 3.9G 125 09:52 test.txt

2.切割,他会以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 125 18:20 log_aa
-rw-rw-r-- 1 android android 500M 125 18:20 log_ab
-rw-rw-r-- 1 android android 500M 125 18:20 log_ac
-rw-rw-r-- 1 android android 500M 125 18:20 log_ad
-rw-rw-r-- 1 android android 500M 125 18:20 log_ae
-rw-rw-r-- 1 android android 500M 125 18:20 log_af
-rw-rw-r-- 1 android android 500M 125 18:20 log_ag
-rw-rw-r-- 1 android android 442M 125 18:20 log_ah
-rw-rw-r-- 1 android android 3.9G 125 09:52 test.txt

3.组装文件,可以把自己想组装的文件进行组合;

//如想把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.text
android@split:~/home/split$ ls -lh test2.text 
-rw-rw-r-- 1 yuanjl yuanjl 1000M 1月  25 18:32 test2.text

ok,就这些,想要了解更深的,可以参考其他牛神;

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值