Concatenate several gz files into one using bash linux command line

Writing by on Tuesday, 22 of September , 2015 at 5:24 am

This will work if there is only one period followed by gz. (*.gz)
Loop over all the files and extract the filename. Then do the usual …

for f in *.gz; do export l=`echo $f | cut -d’.’ -f1` ; gunzip $f; cat $l >> big_file ; gzip $l; done

Leave a comment

Category: Linux

No Comments

No comments yet.

Leave a comment

You must be logged in to post a comment.

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.