I have a big .gz file. I would like to split it into 100 smaller gzip files, that can each be decompressed by itself. In other words: I am not looking for a way of chopping up the .gz file into chunks that would have to be put back together to be able to decompress it. I want to be able to decompress each of the smaller files independently.
Can it be done without recompressing the whole file?
Can it be done if the original file is compressed with --rsyncable
? ("Cater better to the rsync program by periodically resetting the internal structure of the compressed data stream." sounds like these reset points might be good places to split at and probably prepend a header.)
Can it be done for any of the other compressed formats? I would imagine bzip2
would be doable - as it is compressed in blocks.
gzip --rsyncable
given that “gunzip cannot tell the difference” (if you could find a place to split, you could tell that there is a place to split). It might be doable with bzip2 because of its peculiar block feature. – Gilles 'SO- stop being evil' Jan 17 '17 at 23:58gzip -d -c bigfile.gz
. – Kusalananda Jan 18 '17 at 00:18bzip2
file indeed. It would be doable withgz
orxz
only by compressing each chunk independently, so this would require a recompression. – xhienne Jan 18 '17 at 00:59gunzip
cannot tell the difference could also be that resetting the internal structure might happen without--rsyncable
, but will happen more often with--rsyncable
. – Ole Tange Jan 19 '17 at 08:01zip
can create an archive in pieces, but I don't believe they can be restored independently. It's just so they'll fit on external storage media. Given that archives can contain multi-level file trees, it would be kind of difficult or arbitrary to automatically decide where to split things so that restoring just some pieces would yield a usable result. – Joe Jan 22 '17 at 04:20big.tar.gz
butbig-gzs.tar
). Then all or only a few files can be extracted and decompressed. I have tried to extract the last file only in a tar-ball but I guess it can "fast forward" as a tape drive can. – hschou Feb 08 '17 at 12:00split -b
and then usecat
using>>
to append each split file back into the one file. Doesn't matter what you split whether it is already zipped or not. nevermind i just reread what you are asking... u want to be able to decompress the split files. – ron Oct 27 '20 at 19:40