The split command of Linux is a good choice when faced with slicing a large file. It contains a number of parameters that support slicing by row and size.
The syntax for the split command is as follows:
Split [--help][--version][-a][-b][-c][-l] [file to be cut] [output filename prefix]
The corresponding parameters are described as follows:
-A, suffix length used by--suffix-length=n (default is 2)-B,--bytes=size byte size per output file-C,--line-bytes=size The maximum byte size per line for each output file-D,--numeric-suffixes uses a numeric suffix instead of the letter suffix-l,--lines=number sets the number of rows per output file--help Display Help information--version Display version Information
Here are a few examples:
1) Split the file splitTest.txt into multiple files, each file size is 10M. Command:
$ split-b 20m splittest.txt$ lssplitTest.txt xaa xab xac
2) split the file splitTest.txt into multiple files, each file size is 10M. Specify the split file prefix bit split, command:
$ split-b 20m splitTest.txt split$ lssplitaa splitab splitac splitTest.txt
3) Split the file splitTest.txt into multiple files, 500,000 lines per file. Command:
$ wc-l splitTest.txt 1502216 splittest.txt$ split-l 500000 splitTest.txt split$ lssplitaa splitab splitac< C7/>splitad SplitTest.txt
4) Split the file splitTest.txt into multiple files, 500,000 lines per file. Specifies that the split file suffix is a number, the number of digits is 3 bits, and the command:
$ wc-l splitTest.txt 1502216 splittest.txt$ split-l 500000-d-a 3 splitTest.txt split$ lssplit000 split001
split002 split003 splitTest.txt
You can use the Cat command to merge the sliced files into a new file:
$ cat split0* > Original.txt
Reprint Please specify the Source:http://blog.csdn.net/iAm333