split

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

语法

  split [options] [INPUT [PREFIX]]

选项



 -LINES
 -l LINES
 --lines=LINES
    将INPUT的LINES行放入每个输出文件中(即每个输出文件的行数)

 -b BYTES
 --bytes=BYTES
     将INPUT的BYTES字节放入每个输出文件中。(即每个输出文件的BYTE数)
     附加“b”512字节,“k”1024字节,“m”1048576字节
     

 -C BYTES
 --line-bytes=BYTES
     每行最大BYTE数.
     将尽可能多的完整的输入行放入每个输出文件中。对于长于的行
     BYTES字节,将BYTES字节放入每个输出文件,直到小于
     该行的BYTES字节被保留,然后正常继续。BYTES
     具有与`--bytes'选项相同的格式。

 --verbose
     在打开每个输出文件之前对标准错误写一个诊断.


默认情况下,`split’将1000行INPUT(或最后一节留下的内容)放入一个输出文件中

例子

将文件demo.zip拆分为多个100 MB文件:

$ split -b 100m demo.zip

输出文件将以3个字母命名,从xaa,xab开始 …重新组装它们,按字母顺序捕获文件:

$ cat `ls x*` > demo2.zip

split 命令实例:

linux命令:split -b 1k file ; cat x* > file file > x* cat ; file 1k -b split split -b 1k file ; cat x* > filerootopen.com
linux命令:split -b 1k file ; cat x* > file file > x* cat ; file 1k -b split split -b 1k file ; cat x* > filerootopen.com
2018-03-21 05:36:48

linux命令:split -b 19m file Nameforpart Nameforpart file 19m -b split split -b 19m file Nameforpartrootopen.com
linux命令:split -b 19m file Nameforpart Nameforpart file 19m -b split split -b 19m file Nameforpartrootopen.com
2018-01-11 21:00:48

linux命令:split -b 4700000000 file.img.gz file.img.gz. file.img.gz. file.img.gz 4700000000 -b split split -b 4700000000 file.img.gz file.img.gz.rootopen.com
linux命令:split -b 4700000000 file.img.gz file.img.gz. file.img.gz. file.img.gz 4700000000 -b split split -b 4700000000 file.img.gz file.img.gz.rootopen.com
2018-02-19 03:21:48

linux命令:split -b4m file.tgz file.tgz. ; for i in file.tgz.*; do SUBJ="Backup Archive"; MSG="Archive File Attached"; echo $MSG | mutt -a $i -s $SUBJ YourEmail@(E)mail.com YourEmail@(E)mail.com $SUBJ -s $i -a mutt | $MSG echo Attached"; File MSG="Archive Archive"; SUBJ="Backup do file.tgz.*; in i for ; file.tgz. file.tgz -b4m split split -b4m file.tgz file.tgz. ; for i in file.tgz.*; do SUBJ="Backup Archive"; MSG="Archive File Attached"; echo $MSG | mutt -a $i -s $SUBJ YourEmail@(E)mail.comrootopen.com
linux命令:split -b4m file.tgz file.tgz. ; for i in file.tgz.*; do SUBJ="Backup Archive"; MSG="Archive File Attached"; echo $MSG | mutt -a $i -s $SUBJ YourEmail@(E)mail.com YourEmail@(E)mail.com $SUBJ -s $i -a mutt | $MSG echo Attached"; File MSG="Archive Archive"; SUBJ="Backup do file.tgz.*; in i for ; file.tgz. file.tgz -b4m split split -b4m file.tgz file.tgz. ; for i in file.tgz.*; do SUBJ="Backup Archive"; MSG="Archive File Attached"; echo $MSG | mutt -a $i -s $SUBJ YourEmail@(E)mail.comrootopen.com
2018-04-15 18:18:48

linux命令:split -l 12000 -a 5 database.sql splited_file i=1 for file in splited_file* do mv $file database_${i}.sql i=$(( i + 1 )) done done )) 1 + i i=$(( database_${i}.sql $file mv do splited_file* in file for i=1 splited_file database.sql 5 -a 12000 -l split split -l 12000 -a 5 database.sql splited_file i=1 for file in splited_file* do mv $file database_${i}.sql i=$(( i + 1 )) donerootopen.com
linux命令:split -l 12000 -a 5 database.sql splited_file i=1 for file in splited_file* do mv $file database_${i}.sql i=$(( i + 1 )) done done )) 1 + i i=$(( database_${i}.sql $file mv do splited_file* in file for i=1 splited_file database.sql 5 -a 12000 -l split split -l 12000 -a 5 database.sql splited_file i=1 for file in splited_file* do mv $file database_${i}.sql i=$(( i + 1 )) donerootopen.com
2018-05-08 04:37:48

linux命令:split -b 500m file.gz file.gz.part- file.gz.part- file.gz 500m -b split split -b 500m file.gz file.gz.part-rootopen.com
linux命令:split -b 500m file.gz file.gz.part- file.gz.part- file.gz 500m -b split split -b 500m file.gz file.gz.part-rootopen.com
2018-01-28 15:55:48

Linux的Bash命令行(A-Z排序)