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:没一输出档的列数大小。以行数分割文件。