拆分大文件

-b:值为每一输出档案的大小,单位为 byte。
-C:每一输出档中,单行的最大 byte 数。
-d:使用数字作为后缀。
-l:值为每一输出档的列数大小。
[root@#quan#Better zabbix]$split -l 10000 zabbix.haocheng.com.access.log quan.l.log -d
[root@#quan#Better zabbix]$ll
total 72092
-rw-r--r--  1 root root  3106332 Sep  9 09:48 quan.l.log00
-rw-r--r--  1 root root  3367849 Sep  9 09:48 quan.l.log01
-rw-r--r--  1 root root  3284657 Sep  9 09:48 quan.l.log02
-rw-r--r--  1 root root  3017283 Sep  9 09:48 quan.l.log03
-rw-r--r--  1 root root  1982234 Sep  9 09:48 quan.l.log04

 

 

[root@#quan#Better zabbix]$split  -b 5MB zabbix.haocheng.com.access.log 
[root@#quan#Better zabbix]$ll -h
total 29M
-rw-r--r--  1 root root 4.8M Sep  9 09:32 xaa
-rw-r--r--  1 root root 4.8M Sep  9 09:32 xab
-rw-r--r--  1 root root 4.6M Sep  9 09:32 xac
-rw-r--r--. 1 root root  15M Sep  8 23:12 zabbix.haocheng.com.access.log
将15M的文件分割成为三个5M的小文件,xab是默认命名格式

以下为自定义

[root@#quan#Better zabbix]$split  -b 5MB zabbix.haocheng.com.access.log  quan.log
[root@#quan#Better zabbix]$ll -h
total 43M
-rw-r--r--  1 root root 4.8M Sep  9 09:37 quan.logaa
-rw-r--r--  1 root root 4.8M Sep  9 09:37 quan.logab
-rw-r--r--  1 root root 4.6M Sep  9 09:37 quan.logac
-rw-r--r--  1 root root 4.8M Sep  9 09:32 xaa
-rw-r--r--  1 root root 4.8M Sep  9 09:32 xab
-rw-r--r--  1 root root 4.6M Sep  9 09:32 xac
-rw-r--r--. 1 root root  15M Sep  8 23:12 zabbix.haocheng.com.access.log
按行数拆分
[root@#quan#Better zabbix]$split -l 10000 zabbix.haocheng.com.access.log quan.l.log
[root@#quan#Better zabbix]$ll
total 57672
-rw-r--r--  1 root root  3106332 Sep  9 09:45 quan.l.logaa
-rw-r--r--  1 root root  3367849 Sep  9 09:45 quan.l.logab
-rw-r--r--  1 root root  3284657 Sep  9 09:45 quan.l.logac
-rw-r--r--  1 root root  3017283 Sep  9 09:45 quan.l.logad
-rw-r--r--  1 root root  1982234 Sep  9 09:45 quan.l.logae
-rw-r--r--  1 root root  5000000 Sep  9 09:37 quan.logaa
-rw-r--r--  1 root root  5000000 Sep  9 09:37 quan.logab
-rw-r--r--  1 root root  4758355 Sep  9 09:37 quan.logac
-rw-r--r--  1 root root  5000000 Sep  9 09:32 xaa
-rw-r--r--  1 root root  5000000 Sep  9 09:32 xab
-rw-r--r--  1 root root  4758355 Sep  9 09:32 xac
-rw-r--r--. 1 root root 14758355 Sep  8 23:12 zabbix.haocheng.com.access.log

 

posted @ 2019-11-08 10:10  linux——quan  阅读(441)  评论(0编辑  收藏  举报