Sorry for such a short post, folks, but I just found this out recently and was so tickled by it I had to post it somewhere. For those of you who use gzip (should be all our Unix/Linux users), did you know that when you append 2 separate gzipped files in Unix/Linux, you can gunzip the final file to find the second file neatly appended to the first? Here's the quick jist of it:
Cool eh? I was worried about compression corruption, but apparently, Gzip uses a stateless sort of algorithm that doesn't matter where files begin or end. Incidentally, don't try this with any PK utilities (WinZip). You'll simply overwrite the first file with the second!Code:# echo Hello > file1.txt # echo World! > file2.txt # cat file1.txt Hello # cat file2.txt World! # gzip file1.txt # gzip file2.txt # ls file1.txt.gz file2.txt.gz # cat file2.txt.gz >> file1.txt.gz # gunzip file1.txt.gz # cat file1.txt Hello World! #
I came across this while creating a log rotation script. It cuts my work in half. Hope it does the same for someone else. Cheers.


Reply With Quote