Linux basic commands: split

split

A large file may be divided into many small files, the file may need to be split into smaller segments, such as to improve readability to generate a log

grammar

split (option) (file) PREFIX

 

Options

 

-b: each output file size value in units of byte. 

-C: each output profile, the maximum byte number of a single row. 

-d: number as a suffix. 

-l: output value of each profile size columns. 

PREFIX: Representative preamble, the preamble can be used as a cutting document file.

 

Examples

Generate a test file size of 100KB:

 

dd if=/dev/zero bs=100k count=1 of=date.file
结果:
1+0 records in
1+0 records out
102400 bytes (102 kB) copied, 0.00043 seconds, 238 MB/s

 

Using the split command to split date.file file created above into the small size of 10KB file:

split -B 10k date.file 

ls 
结果: 
date.file sent measuring xac xad xae xaf xag xah Topics orders

 

Files divided into a plurality files with suffix letters, if you want to use with a numeric suffix the -d, -a length may be used simultaneously to specify suffix length:

split -b 10k date.file -d -a 3

 ls
结果:
date.file x000 x001 x002 x003 x004 x005 x006 x007 x008 x009

 

Specify the file name for the file divided prefix:

split -b 10k date.file -d -a 3 split_file

 ls
结果:
date.file split_file000 split_file001 split_file002 split_file003 split_file004 split_file005 split_file006 split_file007 split_file008 split_file009

 

The -l option file lines to separate files, for example, to divide the file into smaller files each containing 10 lines:

split -l 10 date.file

 

PS

 cat x*>>y*

 

 The split merge split files into one

 
 
 

split

A large file may be divided into many small files, the file may need to be split into smaller segments, such as to improve readability to generate a log

grammar

split (option) (file) PREFIX

 

Options

 

-b: each output file size value in units of byte. 

-C: each output profile, the maximum byte number of a single row. 

-d: number as a suffix. 

-l: output value of each profile size columns. 

PREFIX: Representative preamble, the preamble can be used as a cutting document file.

 

Examples

Generate a test file size of 100KB:

 

dd if=/dev/zero bs=100k count=1 of=date.file
结果:
1+0 records in
1+0 records out
102400 bytes (102 kB) copied, 0.00043 seconds, 238 MB/s

 

Using the split command to split date.file file created above into the small size of 10KB file:

split -B 10k date.file 

ls 
结果: 
date.file sent measuring xac xad xae xaf xag xah Topics orders

 

Files divided into a plurality files with suffix letters, if you want to use with a numeric suffix the -d, -a length may be used simultaneously to specify suffix length:

split -b 10k date.file -d -a 3

 ls
结果:
date.file x000 x001 x002 x003 x004 x005 x006 x007 x008 x009

 

Specify the file name for the file divided prefix:

split -b 10k date.file -d -a 3 split_file

 ls
结果:
date.file split_file000 split_file001 split_file002 split_file003 split_file004 split_file005 split_file006 split_file007 split_file008 split_file009

 

The -l option file lines to separate files, for example, to divide the file into smaller files each containing 10 lines:

split -l 10 date.file

 

PS

 cat x*>>y*

 

 The split merge split files into one

Guess you like

Origin www.cnblogs.com/wzy23/p/11388665.html