compression - Uncompress, edit, compress and concatenate files -
i have bunch of large compressed files want concatenate. problem is, don't have newline characters @ end of uncompressed version, if try cat them , work on them compressed, last line in 1 file joined first line in next file (which throws error software i'm using). cat'ing them new-line inserted between each compressed file doesn't work think gzip detects newline character , thinks after 'trailing garbage'.e.g.
for f in *.gz; (cat "${f}"; echo) >> all.gz; done; gzip -d all.gz gzip: all.gz: decompression ok, trailing garbage ignored
what i'd this:
unzip file1.gz | add newline char| gzip output >> output.gz
and same file2.gz, file3.gz, etc., etc.
any suggestions?
you don't need decompress , recompress. compress one-byte new-line character gzip, , concatenate between large gzip files.
echo | gzip > newline.gz cat file1.gz newline.gz file2.gz newline.gz file3.gz ... > file.gz
it 21-byte file insert each new-line, since said other files large, shouldn't matter.