前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ubuntu split命令文件切割

ubuntu split命令文件切割

作者头像
逍遥子大表哥
发布2021-12-17 14:30:44
2.2K0
发布2021-12-17 14:30:44
举报
文章被收录于专栏:kali blog

有时会遇到文件比较大,无法查阅,需要切割才行;

命令参数:

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.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 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.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

如果想全部组装起来;

cat log_* > test2.textandroid@split:~/home/split

版权属于:逍遥子大表哥

本文链接:https://cloud.tencent.com/developer/article/1920607

按照知识共享署名-非商业性使用 4.0 国际协议进行许可,转载引用文章应遵循相同协议。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档