zgrep在目录中的多个文件GZ [英] zgrep multiple gz files in directory
本文介绍了zgrep在目录中的多个文件GZ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在那里我有近1000 <$目录c寻找字
执行 zgrep
命令问题$ C> *。GZ 文件。
I have problem executing zgrep
command for looking for word
in the directory where I have almost 1000 *.gz
files.
我试图用
find /var/www/page/logs/ -name "*.gz" -exec zgrep '/index.php' {} \;
结果是:
GET : '/index.php'
GET : '/index.php'
GET : '/index.php'
和它works.I获得的次数列表的index.php
中,在其中未发现文件名。它是一种无用的我,除非我知道在哪些文件(文件名)出现。
And it works.I get list of occurance of index.php
with no file name where it was found. It is kind of useless for me unless i knew in which files (filename) it appears.
我该如何解决呢?
推荐答案
您可以提供 -H
选项列出的文件名:
You could supply the -H
option to list the filename:
find /var/www/page/logs/ -name "*.gz" -exec zgrep -H '/index.php' {} \;
如果你想只匹配文件列表中,使用 -l </ code>:
If you wanted only the list of matching files, use -l
:
find /var/www/page/logs/ -name "*.gz" -exec zgrep -l '/index.php' {} \;
这篇关于zgrep在目录中的多个文件GZ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文