Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email 



SPLITTING LARGE FILES


Split is a command we use for splitting large files into smaller ones without corrupting the integrity of the file. We can later merge the files again to the original size.
Why would we want to do that ? Well, an example would be if your laptop only has a floppy drive and you want to copy a large file from your PC to your laptop.

This is how it works:

CODE
# split -b1m lastweek.mp3 lastweek.mp3.


( The first ¨lastweek.mp3¨ is the original file, while the second ¨lastweek.mp3.¨ is the name of the new files, the last dot has to be there for the double extension, or else it won't work. The -b stands for bytes, the ¨1m¨ means in portions of 1 MB . You can use -l instead of -b, then it will be the number of lines, the default is 1,000 lines )

If the original file was 5.6 MB you will get 6 files named: , lastweek.mp3.aa, lastweek.mp3.ab, lastweek.mp3.ac, lastweek.mp3.ad, lastweek.mp3.ae and lastweek.mp3.af ( the last one only 0.6MB )

Merging them together on the laptop is quite simple too:

CODE
$ cat lastweek.mp3.* >lastweek.mp3

( don't forget the * )

That's all, so now you've got a spotless lastweek.mp3 of 5.6 MB on the laptop.


Bruno





Yarg mailed us, "I found the windows command that would successfully combine the files":

CODE
# copy/b file1+file2+file3 newfile


-- Aug 22 2003 ( Revised Jan 28 2006 ) --


Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email