Thursday, September 21, 2017

zip to gzip


Assume you are in a directory which has few zip files. Each zip file has a large text file in it. You need to convert the zip file to gzip using unix command. Below is the command. You put all of them in1 line. For readability statements are in their own line

for f in *.zip; 
do 
unzip $f; 
mv ./*.txt `basename $f .zip`.txt;
gzip ./*.txt; 
done

No comments:

Post a Comment