我目前的问题是有大约10个文件夹,其中包含gzipped文件(平均每个文件夹有5个)。这使得需要打开并查看50个文件。
是否有更简单的方法来确定文件夹中的gzipped文件是否具有特定的模式?
zcat ABC/myzippedfile1.txt.gz | grep "pattern match"
zcat ABC/myzippedfile2.txt.gz | grep "pattern match"
我是否可以一行代码完成对所有文件夹及其子文件夹相同操作的任务,而无需编写脚本?
for f in `ls *.gz`; do echo $f; zcat $f | grep <pattern>; done;
zgrep -R --include=\*.gz -H "pattern"
- blacktooth-R
选项。 - sorininclude
似乎也不受支持/sw/bin/zgrep: --include=*.gz: option not supported
。 - Anupam