Operating System - HP-UX
1832857 Members
3202 Online
110048 Solutions
New Discussion

Re: Change a large file to sereval small files

 
haeman
Frequent Advisor

Change a large file to sereval small files

I have a .tar.gz have 22M in size , I would like to separate it into three files , can advise what can i do ? thx
6 REPLIES 6
VK2COT
Honored Contributor

Re: Change a large file to sereval small files

Hello,

Simplest possibility - comes with the operating
system:

split â split a file into pieces

Example at the command-line (to split your
archive into 5 MB files):

# split -b 5m myarch.tar.gz myarch

Cheers,

VK2COT
VK2COT - Dusan Baljevic
Steven Schweda
Honored Contributor

Re: Change a large file to sereval small files

Depending on what you intend to do with the
pieces, "man split" could be informative.
Yogeeraj_1
Honored Contributor

Re: Change a large file to sereval small files

hi,

try the 'split' command.

and to get it back to original, use the 'join' command

if you need any further assistance, please let us know.

hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Dennis Handly
Acclaimed Contributor

Re: Change a large file to several small files

>yogeeraj: to get it back to original, use the join command

I doubt join(1) will work. The opposite of split(1) is cat(1).

Arturo Galbiati
Esteemed Contributor

Re: Change a large file to sereval small files

Hi,
several way:
split if you ant to simply split it by size, or by content you can use grep, sed, awk, perl, etc.

HTH,
Art
Yogeeraj_1
Honored Contributor

Re: Change a large file to sereval small files

Thank you Dennis for the clarification.

Be careful when you use split and cat to split and concatenate files back again. The proper sequence of files is crucial and will prevent any form of data corruption.

Sorry again for this wrong reply and inconveniences.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)