问题原文
原帖链接 · user23398 · CC BY-SA 3.0
First the specific problem: In linux, I use zcat to list a .zip file. In osx, zcat seems to automatically append .Z to the file name. Various people suggest replacing zcat with gzcat; however, gzcat complains that the file is not in gzip format!
'file ' shows this: ...Zip archive data, at least v2.0 to extract
So neither zcat or gzcat will work in osx, what can I do?
I have a medium sized script in in bash which uses, zcat/gzcat, sed awk and other basic utilities to process a number of files. I'd like to duplicate that environment on my osx laptop so I can work offline. Any general suggestions how I can avoid such pain? I expect this is a fairly routine workflow so must have been sorted out by others.
社区高分解答
原帖链接 · dakdad · CC BY-SA 3.0
I know this is an old question. However, I found a solution from an even older github thread.
You can simply use gunzip -c that works similar to zcat without the errors on Mac OS X.
$ gunzip -c 20150707_backup.sql.gz | mysql -u mysql_user -p
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
