Split large files into a number of smaller files in Unix
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:
n this simple example, assume myfile is 3,000 lines long:
This will output three 1000-line files: xaa, xab, and xac.
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.