Split can split the specified file according to the row or size.
Syntax: Split [OPTION] ... [INPUT [PREFIX]]
Description: split [ parameter list ] [ file name prefix generated after splitting file [split]]]
Note: The default split file will exist in the current working directory, and in the directory where the PWD command is located, the file name generated by default is increased in AA, AB, ac order, and if the number of files being split is too high (over 600) you have to use the-a parameter to modify the file name length after splitting.
Common ways: (Split file name: Split.json, generate filename prefix split-tmp-)
Split into 1000 rows of one file
Split-l Split.json split-tmp-
Split into 1M a file
Split-b 1M Split.json split-tmp-
Parameter list:
-A,--suffix-length=n
Description: The length of the sequential file name is generated after splitting, the default is 2, when the-D or--numeric-suffixes[=from] parameter is not used, the split file is generated for AA, AB, AC, ad sequence increments.
--additional-suffix=suffix
Description: Specifies the file name suffix that is generated after the split, no suffix by default, or Aa.json, Ab.json, Ac.json for the resulting split file as specified--additional-suffix=.json.
-B,--bytes=size
Description: Specifies the size of each split file, which can be used in units (K, M, G, T, P, E, Z, Y) or (KB, MB,GB,TB,PB,EB,ZB,YB) units into 1024 bytes.
-C,-line-bytes=size
Description: Similar to-b parameter, but here is the integrity of each row under the split file, the available units are the same as-B.
-D,--numeric-suffixes[=from]
Description: Specifies that the build sequence file name is numeric when split, and defaults to 00, 01, 02, 03. Or specify a start value.
Such as:
Split-l 1000-d Split.json split-tmp-
Or
Split-l--numeric-suffixes=10 Split.json split-tmp-
Note: If you do not specify a prefix for the split build file name, the default is to add X to the number, such as: X00, x01, x02
-E,--elide-empty-files
Description: Specifies that a split file is not generated when the file is empty, only for use of the-N or--number=chunks parameters.
--filter=command
Description: Invoking the shell script file filtering processing, the script gets split to generate the file name of the variable is $FILE, gets the file contents using the variable is $file. This is a high-level command that can be used to process the final split file structure using these two variables.
Note: After using this parameter, the current command is not to generate a split file if you want to write the split file to be handled by a generic shell command.
-L,--lines=number
Description: Specifies the maximum number of rows for each file after splitting.
-N,-number=chunks
Description: Splits the build block file.
chunks Parameter description:( Note: N and K are numeric values and k<n,l with R are keywords )
n is divided into n files of approximately size and saved. Cases:
Split-n Split.json split-tmp-
The k/n is divided into n similar files and the output shows the contents of the file from K to N, without saving the file. Cases:
Split-n 9/10 Split.json
l/n guarantees that each line is completely and evenly divided into N files and saved. Cases:
Split-n L/10 Split.json split-tmp-
The l/k/n guarantees that each line is completely relatively evenly divided into n files and outputs the contents of the file from K to N, without saving the file. Cases:
Split-n L/9/10 Split.json
r/n is similar to l/n but uses a cyclic distribution (distribution uniformity is not l/n high) and saves the file. Cases:
Split-n R/10 Split.json split-tmp-
r/k/n is similar to l/n but uses a cyclic distribution (distribution uniformity is not l/n high) and outputs file contents from K to N without saving the file. Cases:
Split-n R/9/10 Split.json
-U,--unbuffered
Description: No buffering immediately copies the input to the output for use with the-N or--number=chunks parameter and the parameter value is r/*.
--verbose
Description: Print out the generated file information after each split
--help
Description: Display command Help
--version
Description: Display command version related information
Split files if you want to merge can use the command: (Files to be merged are: AA, AB, AC, ad merge after file name Merge.log)
Cat AA ab AC ad > Merge.log
This article is from the "gangbusters" blog, make sure to keep this source http://php2012web.blog.51cto.com/5585213/1660968
Split files under Linux splitting