Splitting files and data
Splitting of files into many smaller pieces becomes essential in certain situations. Earlier, when memory was limited with devices such as floppy disks, it was crucial to split files into smaller file sizes to split files across many disks. However, nowadays we split files for other purposes, such as readability, for generating logs, sending files over e-mail, and so on. In this recipe we will see various ways of splitting files in different chunks.
How to do it...
Let's say we have a test file called data.file
, which has a size of 100 KB. You can split this file into smaller files of 10k each by specifying the split size as follows:
$ split -b 10k data.file $ ls data.file xaa xab xac xad xae xaf xag xah xai xaj
It will split data.file
into many files, each of a 10k chunk. The chunks will be named the manner xab
, xac
, xad
, and so on. This means it will have alphabetic suffixes. To use the numeric suffixes, use an additional -d
argument. It is also possible...