Actually I am in great agony recoverying a corrupt gzip file, possibly due to interrupted ftp transfer and then resume. After googling I found Recovering a damaged .gz file and am trying as it reads.
What I'm doing now is merging a gzip header file with some last part of the damaged file varying the size of the last part. Then I test the merged file as a gunzip input if it can produce a meaningful result. I wrote a script and the following is the best what I can to redirect the merge to gunzip. What is more efficient way to redirect file content to gzip? I guess you should not create any file. ($i is a size variable)
cat head > x.gz; tail -c $i tail >> x.gz; gzip -t x.gz 2>&1 1>/dev/null