File splitting command under Linux split

Source: Internet
Author: User

Usage: Split [options] ... [input [prefix]]
Split the input into fixed-size shards and output to prefix AA, prefix ab,... ;
The default is split units with 1000 behavior, and the default prefix is "x". If you do not specify a file, or
If the user file is "-", the data is read from the standard input.

The long option must use parameters that are also required for short options.
-A,--suffix-length=n specifies a suffix length of N (default = 2)
-B,--bytes= size specifies the byte size of each output file
-C,--line-bytes= size specifies the maximum row byte size in each output file
-D,--numeric-suffixes uses a numeric suffix instead of a letter suffix
-L,--lines= value specifies how many rows each output file has
--verbose output file characteristics before each output file is opened
--HELP Display this help message and exit
--version display version information and exit

The SIZE can be an optional integer followed by one of the following units:
KB 1000,k 1024,mb 1000*1000,m 1024*1024, also G, T, P, E, Z, Y.

Example:
$ ls-l
-rw-r--r--1 User User 3773144 May 10:54 splittest.tar.bz2

$split-A-b 800KB splittest.tar.bz2 sp
-A 3 #指定后辍为3位
-D #指定后辍为数字, not the default AA ab etc.
-B 800KB #分割的大小
SP #前辍

$ls-L
-rw-r--r--1 User User 800000 May 11:05 sp000
-rw-r--r--1 User User 800000 May 11:05 sp001
-rw-r--r--1 User User 800000 May 11:05 sp002
-rw-r--r--1 User User 800000 May 11:05 sp003
-rw-r--r--1 User User 573144 May 11:05 sp004
-rw-r--r--1 User User 3773144 May 10:54 splittest.tar.bz2
As you can see, sp000-sp004 is the split file.


Merge:
$cat sp00* >splittest1.tar.bz2
$ls-L
-rw-r--r--1 User User 800000 May 11:05 sp000
-rw-r--r--1 User User 800000 May 11:05 sp001
-rw-r--r--1 User User 800000 May 11:05 sp002
-rw-r--r--1 User User 800000 May 11:05 sp003
-rw-r--r--1 User User 573144 May 11:05 sp004
-rw-r--r--1 User User 3773144 May 11:11 splittest1.tar.bz2
-rw-r--r--1 User User 3773144 May 10:54 splittest.tar.bz2
As you can see, the merged file splittest1.tar.bz2 is consistent with the splittest.tar.bz2 size before the split

$ md5sum splittest1.tar.bz2
12951203bd64c314d14a57b5d57f2592 splittest1.tar.bz2
$ md5sum splittest.tar.bz2
12951203bd64c314d14a57b5d57f2592 splittest.tar.bz2

Compare the MD5 checksum of two files respectively to confirm that the merge is correct.

File splitting command under Linux split

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.