I'm trying to decompress a gz file and rename it. The issue is that the file has size 0 after doing it:
var1="imdb"
var2="gz"
var3="tsv"
gzip -d --no-name "/tmp/${var1}.${var2}" > "tmp/${var1}.${var3}
After this I check ls -l /tmp and get the following
777642064 imdb
0 imdb.tsv
I tried the same with the following, it works but then it uses a random name:
gzip -d --name "/tmp/${var1}.${var2}"
777642064 randoname.tsv
One option is to force
gzipto write the decompressed data to stdout (-c) and then redirect stdout to the desired file, eg:NOTE: this will leave the original zipped (
.gz) file in place