Split
The split command or utility allows you to split by lines, size or the number of smaller files you need. Another related utility is csplit than can also be used.
Split files based on # of lines
$ split -l 275 bigfile.txt$ split -l 275 bigfile.txt smallfile-$ split -l 275 -d bigfile.txt smallfile-$ split -l 275 -d bigfile.txt smallfile- --additional-suffix=.txtSplit files based on size
$ split -b 5k bigfile.txt smallfile-Split into specific number of files
$ split -n 2 -d bigfile.txt smallfile-
Split based on content
Last updated