How to unzip the file_name.csv.gz files to .csv

Issue

I want to unzip files which are in *.csv.gz format to .csv format.

When I tried with these commands $ gzip -d file.gz and $ gzip -f file.gz, it is showing like

gzip: IQ.gz: No such file or directory
gzip: Envoy.gz: No such file or directory
gzip: compressed data not read from a terminal. Use -f to force decompression.
For help, type: gzip -h

Please help me on this to how to unzip.

Solution

find . -name '*.csv.gz' -print0 | xargs -0 -n1 gzip -d

Should sort you, alternatively:

find . -name '*.csv.gz' -exec gzip -d {} \;

will also work. These are recursive so they will go into subdirs.

Answered By – hd1

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published