Split files into pieces (POSIX)
split [-a suffix_length] [-b n[k|m]] [-l line_count] [-p pattern] [file [name]]
The split utility reads an input file and writes the data from that file into one or more output files.
By default, the names of the output files are xaa, xab, ..., xzz, and each output file, except possibly the last, gets 1000 lines.
The last file contains the remainder of the input file, and therefore may be smaller than the requested size. Conversely, it may be longer than the other files if there are too few filenames available to take all the input in chunks of the specified size.
Suppose you have a file named big_file that's 8192 lines in length. The following command creates nine files named xaa, xab, xac, ..., xai. The first eight files all contain 1000 lines, while the last file contains only 192:
Again, assuming that big_file is 8192 lines in length, the following command creates only two files: smaller_aa, which contains 8000 lines, and smaller_ab, which contains 192 lines:
split -l 8000 big_file smaller_
You can use any file as input, but if you're splitting a nontext file, you must specify option -b. The output files contain portions of the original input file that are otherwise unchanged.
cat, cut, gawk, head, sed, tail