split
From NetBSD Wiki
The split(1) command can split up large files into smaller, equally sized chunks.
Example:
$ cat test line1 line2 line3 line4 line5 $ split -l 2 test piece $ ls test pieceaa pieceab pieceac $ cat pieceaa line1 line2 $ cat pieceab line3 line4 $ cat pieceac line5
The name you supply after the name of the file to split is the base name of the pieces. This is 'x' by default, if you don't supply it. (so you will get files called 'xaa', 'xab', etc)
You can 'unsplit' a file simply by using cat to join the files together into one big stream:
$ cat piecea[abc] line1 line2 line3 line4 line5
The above example split based on lines, but a much more common use case is when you want to split a file on a certain byte size limit so you can split it among floppy disks, for example. We can use the -b argument for that.
$ split -b 1440k myfile newfile $ ls myfile newfile1 newfile2 ...
The k suffix indicates a size in kilobytes. You can of course also use m for megabytes, or no suffix for bytes.
If you don't supply a size at all (whether in bytes or lines), it will default to 1000 lines per file.
