Sunday, 20 February 2011

How to merge files on Linux from console level

If someone sent you a parted file (for example a 7zip parted archive) you will need to merge these files before use (for example before extract a 7zip archive). On GNU/Linux operating system it is very simple. To do that you can use a 'cat' command and redirect of default output stream.

cat filename.part001 >> filename;
cat filename.part002 >> filename;
.......
cat filename.partN >> filename;

You should use double '>' sign to avoid overriding data. Single '>' sign means to delete content of file (here 'filename' ) and to put in data from filename.partN file. Double '>' will concatenate present content of file with data from filename.partN.

Good luck :)

Some rights reserved - CC-BY-SA-3.0 License.