split
Description
The split utility reads the given file (or standard input if no file is specified) and breaks it up into files of, by default, 1000 lines each.
The options are as follows: -b Create files byte_count bytes in length. If ``k'' is appended to the number, the file is split into byte_count kilobyte pieces. If ``m'' is appended to the number, the file is split into byte_count megabyte pieces. -l Create output files n lines in length. -a Use suffix_length letters to form the suffix portion of the file- names of the split file. If -a is not specified, the default suffix length will be two. If the sum of the name operand and the suffix_length option-argument would create a filename exceeding {NAME_MAX} bytes, an error will occur, and split will exit with no output files having been created.
Example
# ls -lh largefile -rw-r--r-- 1 root root 251M Feb 19 10:27 largefile # split -b 2m largefile LF_ # ls -lh LF_* | head -n 5 -rw-r--r-- 1 root root 2.0M Feb 19 10:29 LF_aa -rw-r--r-- 1 root root 2.0M Feb 19 10:29 LF_ab -rw-r--r-- 1 root root 2.0M Feb 19 10:29 LF_ac -rw-r--r-- 1 root root 2.0M Feb 19 10:29 LF_ad -rw-r--r-- 1 root root 2.0M Feb 19 10:29 LF_ae # ls -lh LF_* | wc -l 126
Keywords
split, chunk