2
To split large files into smaller files in Unix, use the
split
command. At the Unix prompt, enter:split [options] filename prefix
Replace
filename
with the name of the large file you wish to split. Replace prefix
with the name you wish to give the small output files. You can exclude [options]
, or replace it with either of the following:-l linenumber -b bytes
- n this simple example, assume
myfile
is 3,000 lines long:split samplefile
This will output three 1000-line files:xaa
,xab
, andxac
. - Working on the same file, this next example is more complex:
split -l 500 samplefile segment
This will output six 500-line files:segmentaa
,segmentab
,segmentac
,segmentad
,segmentae
, andsegmentaf
. - Finally, assume samplefile is a 160KB file:
split -b 40k samplefile segment
2Awesome Comments!
Good One
Thanks Venky