Linux命令学习之路---文件分割(split)命令

Usage: split [OPTION]... [INPUT [PREFIX]]
Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default
size is 1000 lines, and default PREFIX is `x'.  With no INPUT, or when INPUT
is -, read standard input.


Mandatory arguments to long options are mandatory for short options too.
  -a, --suffix-length=N   use suffixes of length N (default 2)
  -b, --bytes=SIZE        put SIZE bytes per output file
  -C, --line-bytes=SIZE   put at most SIZE bytes of lines per output file
  -d, --numeric-suffixes  use numeric suffixes instead of alphabetic
  -l, --lines=NUMBER      put NUMBER lines per output file
      --verbose           print a diagnostic just before each
                            output file is opened
      --help     display this help and exit
      --version  output version information and exit


SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.


Report split bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report split translation bugs to <http://translationproject.org/team/>

For complete documentation, run: info coreutils 'split invocation'


功能说明:切割文件。

  语  法:split [--help][--version][-<行数>][-b <字节>][-C <字节>][-l <行数>][要切割的文件][输出文件名]

  补充说明:split可将文件切成较小的文件,预设每1000行会切成一个小文件。

参 数:

  -<行数>或-l<行数>  指定每多少行就要切成一个小文件。

  -b<字节>  指定每多少字就要切成一个小文件。支持单位:m,k

  -C<字节>  与-b参数类似,但切割时尽量维持每行的完整性。

  --help  显示帮助。

  --version  显示版本信息。

[输出文件名]  设置切割后文件的前置文件名,split会自动在前置文件名后再加上编号。

例如:

split -b 20m test.log  test_part_

ls -lh
total 160M
-rw-rw-r-- 1 tcl_oss tcl_oss 80M Jul 17 13:51 test.log
-rw-rw-r-- 1 tcl_oss tcl_oss 20M Jul 17 13:53 test_part_aa
-rw-rw-r-- 1 tcl_oss tcl_oss 20M Jul 17 13:53 test_part_ab
-rw-rw-r-- 1 tcl_oss tcl_oss 20M Jul 17 13:53 test_part_ac
-rw-rw-r-- 1 tcl_oss tcl_oss 20M Jul 17 13:53 test_part_ad

使用cat test_part_* > test1.log合并文件

使用MD5SUM校验文件



表明合并以后的文件和拆分之前的文件是一样的,采用这种方式可以在文件较大时,分割进行传输;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值