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

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">