Quick tip: split a large file into smaller files

Needed to break a large file containing many messages, each message separated on a new line into many new small files containing only one message per file … Started thinking in perl, but almost looked past the Unix split command:

split -l 1 -a 3 bigfile.txt smallfile_

-l ‘n’ will put ‘n’ lines per file
-a ‘n’ defines the length of the suffix, in this case 3 letters

QED

Comments are closed.