您的位置:首页 > 运维架构 > Linux

每天回顾linux命令(split)

2017-10-30 23:25 369 查看
split命令

split命令可以将一个大文件分割成很多个小文件,有时需要将文件分割成更小的片段,比如提高可读性,生成日志等。

选项

-a:表名文件后缀的大小,默认为2

root@62bf1a913608:/home/wzm/testsplit# ll redis.conf
-rw-r--r-- 1 root root 57764 Oct 30 15:14 redis.conf
root@62bf1a913608:/home/wzm/testsplit# ls
redis.conf
root@62bf1a913608:/home/wzm/testsplit# split  -b10240 redis.conf -d -a 10 redis.conf
root@62bf1a913608:/home/wzm/testsplit# ls
redis.conf            redis.conf0000000001  redis.conf0000000003  redis.conf0000000005
redis.conf0000000000  redis.conf0000000002  redis.conf0000000004


-b:为每个文件档案的大小,单位为字节。

root@62bf1a913608:/home/wzm/testsplit# ll redis.conf
-rw-r--r-- 1 root root 57764 Oct 30 15:14 redis.conf
root@62bf1a913608:/home/wzm/testsplit# split -d -b10240 redis.conf
root@62bf1a913608:/home/wzm/testsplit# ls
redis.conf  x00  x01  x02  x03  x04  x05


-c:每一输出档中,单行的最大byte数

-d:使用数字作为后缀,如-b例子,没加-d如下:

root@62bf1a913608:/home/wzm/testsplit# ll redis.conf
-rw-r--r-- 1 root root 57764 Oct 30 15:14 redis.conf
root@62bf1a913608:/home/wzm/testsplit# split  -b10240 redis.conf
root@62bf1a913608:/home/wzm/testsplit# ls
redis.conf  xaa  xab  xac  xad  xae  xaf


-l:没一输出档的列数大小。以行数分割文件。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: