How to Split (and Rejoin) A File

by Ferdi

Found on main PClinuxOS forum at:

http://www.pclinuxos.com/forum/index.php?topic=14013.msg111147#msg111147

Sometimes you may wish to split a file, thereby making it easier to email or fit on storage devices. Here is a quick refresher course on splitting and joining.

Splitting

  • Open a konsole. (In KDE, this involves either clicking on the icon of the "Konsole Terminal Program" on the KDE menu bar, or using Main Menu -> Terminals -> Terminal Program.)
  • CD (change directory) to the directory where the file to be split is located. For instance,
  • cd /home/ferdi/mymp3s

  • To split a sample file (filename.mp3) into 2Mb parts with a suffix consisting of 2 numbers do:
  • split -a 2 -b 2m -d filename.mp3 parts

  • The option '-a 2' tells 'split' to use a suffix length of 2.
  • The option '-b 2m' tells 'split' to make parts of 2Mb size
  • The option '-d' tells 'split' to use numbers for the suffix instead of the default characters.
  • 'parts' is the first half of the name of the smaller files: parts00 parts01 parts02...
  • If the new smaller files don't show up immediately in Konqueror, hit F5 to force a screen refresh.

Joining

  • To join the smaller parts use the following:
  • cat parts* > filename.mp3

    The * (wildcard) tells 'cat' to use all files in the current directory that start with 'parts'.

donate

Top