split
按照数据大小和行数来分割文件
指定分割文件后缀
split -b 10k data.file
split -b 10k data.file -d -a 4
指定前缀
split [command_args] prefix
split -b 10k data.file -d -a 4 split_file
按行分割文件
split -l 10 data.file
按照文件自身特点分割csplit
有文本文件如下:
SERVER-1[connection] 192.168.0.1 success[connection] 192.168.0.1 success[connection] 192.168.0.1 successSERVER-2[connection] 192.168.0.1 success[connection] 192.168.0.1 success[connection] 192.168.0.1 successSERVER-1[connection] 192.168.0.1 success[connection] 192.168.0.1 success[connection] 192.168.0.1 success
按照服务器分割文件
csplit server.log /SERVER/ -n -s {*} -f server -b "%02d.log"; rm server00.log