Linux split command

We can use split command to split one file to a number of files.
By default the ‘split’ will split the file into files that contain 1000 lines each one, and the remaining in the last file. but we can use the ‘l’ param to change the number of lines in the divided  files.

so if we have file index.html that contain 16 lines and we run


split -l 4 index.html

we will get 4 files, each one contain 4 lines.

for binary file we can use the ‘-b’ option, and after the specify the binary size.

For example:


split -b 2m archive.tar

will split the file archive.tar into file with the size of 2m (last file will be the remaining size)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s