linux - Append one line at the top of huge gzip file -


i have huge gzip file (~400mb). want append 1 line of text @ beginning of file.

i thinking of creating gzip file header line , using zcat combine header file , log file. wanted check if there better/elegant/efficient way it.

two gzipped files concatenated single file valid gz file.

try it.

gzip first, single line want prepend, cat 2 third.

print "my newline" | gzip -c > /tmp/smallzip.gz cat /tmp/smallzip.gz mybigfile.gz > newbigfile.gz  

that save time , cpu of unzipping big gz file, prepending line , rezipping, be:

(     echo "my newline"     zcat bigfile.gz ) | gzip -c > newbifile.gz  

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -