Home > linux > Split files in linux

Split files in linux

I have a large database export file (7G)  and I want to split in volumes using zip. But the zip version of the machine is 2.32, that has no -s parameter to split files (version 3.0 has this parameter).

The last supported version of zip is 2.3 (Red Hat Enterprise Server release 5.3, a production machine), and our policy is not to install uncertified versions on the production environment.

So I gzipped the file and then I splitted in 500M chunks:


$ gzip file.dmp

$ split -b 500M file.dmp.gz /var/mike/file.dmp.gz_

This generates N files named file.dmp.gz_aa, file.dmp.gz_ab, file.dmp.gz_ac…

To unsplit the files, just “cat” it:


$ cat /var/mike/file.dmp.gz_* > file.dmp.gz

Advertisements
Categories: linux Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: