Linux文件分割与合并

工作学习 Add comments

apache 默认不支持超过2G文件的下载,这个方法可以解决下!

split

功能说明:切割文件。  

语  法:split [--help][--version][-<行数>][-b <字节>][-C <字节>][-l <行数>][要切割的文件][输出文件名]
补充说明:split可将文件切成较小的文件,预设每1000行会切成一个小文件。

参  数:
-<行数>或-l<行数>  指定每多少行就要切成一个小文件。
-b<字节>  指定每多少字就要切成一个小文件。
-C<字节>  与-b参数类似,但切割时尽量维持每行的完整性。
--help  显示帮助。
--version  显示版本信息。
[输出文件名]  设置切割后文件的前置文件名,split会自动在前置文件名后再加上编号。

Examples
$ split -b 22 newfile.txt new
would split the file “newfile.txt” into three separate files called newaa, newab and newac each file the size of 22.

$ split -l 300 file.txt new
would split the file “newfile.txt” into files beginning with the name “new” each containing 300 lines of text each

合并:

OS Linux:

cat newaa newab newac > newfile.txt

OS Windows:

copy /B newaa + /B newab + /B newac newfile.txt /B

在Linux下看文件合并后是否与原来一致:

md5sum newfile.txt

比较两次的md5号就可以了.

17fav 收藏本文

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS 登录

收藏 & 分享

Powered by 17fav.com