APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Split

Breaks a file up into separate files, either by lines or bytes.


split -l1 /etc/passwd
 

will create a new file (xaa,xab, etc.) for each line of /etc/passwd.

Split is useful when you need to send a large file to someone whose isp enforces quotas on the size of mail files.

You can control the naming convention:

split -l 5000 bigfile foo.
 

will create 5000 line chunks named foo.aa, foo.ab etc. Some versions of split do that differently; check your man page.

To re-combine the files, use

cat foo.* > newbigfile
 

or, on a Windows machine,

copy FOO.* /B newbigfile /b
 


Got something to add? Send me email.




Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence



Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us