Re: Adding text to a compressed file without uncompressing

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Matt Graham
Date:  
To: Main PLUG discussion list
Subject: Re: Adding text to a compressed file without uncompressing
> On Oct 31, 2013 1:40 AM, "Bryan O'Neal"
>> So let's say I have a few hundred lines of text I need at the
>> beginning
>> or end of a big compressed text file. Say a 20GB uncompressed / 4GB
>> compressed JSON or XML doc. Now lets say I have no desire to
>> uncompress this file and I have no desire to use interactive tools
>> like vim. How could I achieve this?


What compression method are you using? (Storing that much data in one
XML file seems like a total organizational failure to me, too.)

I don't think you can do this with zip, not sure about lzma, but I
would guess "not ever at the start of the file for any commonly-used
compression method". Data compression's weird like that.

You can do a bit of appending if you're using gzip:

gzip -c file.txt > foo.gz
gzip -c file2.txt >> foo.gz
gzip -dc < foo.gz

(decompresses foo.gz to stdout, you will get file.txt followed by
file2.txt)

Stephen wrote:
> Tar has a built in append feature so you can add files to the archive


tar will refuse to append things to compressed archives.

--
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss