I have problem executing zgrep
command for looking for word
in the directory where I have almost 1000 *.gz
files.
I am trying with:
find /var/www/page/logs/ -name "*.gz" -exec zgrep '/index.php' {} \;
result is:
GET : '/index.php'
GET : '/index.php'
GET : '/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.
How can i fix it?
You could supply the -H
option to list the filename:
find /var/www/page/logs/ -name "*.gz" -exec zgrep -H '/index.php' {} \;
If you wanted only the list of matching files, use -l
:
find /var/www/page/logs/ -name "*.gz" -exec zgrep -l '/index.php' {} \;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With