Zcat adds .Z in Mac OS
2013-08-29
Zcat is a great tool to output the contents of a gzipped file. You can use it to do snazzy things like pipe a gzipped database archive into mysql without waiting for it to decompress to a normal file first. Coming from Linux, you might just think that Mac OS is similar enough to whip out zcat and go to town. Unfortunately, Mac OS's zcat tries to append ".Z" to the file argument, and you get something like "thatfile.gz.Z doesn't exist". I'm guessing this has something to do with Mac OS's BSDness, but it doesn't really matter.
To avoid this behaviour, just use gzcat! Gzcat has all the goodness of zcat, but doesn't try to append ".Z".
gzcat yourfile.gz