Reputation: 342
How to search for a pattern in files in a directory with:
I'm trying like this:
grep -lir "eval" --include '*.php' ./
But it's not enough.
Also, a second part that I want to search in php code only. So it means the matched pattern should be after <?
and not after ?>
.
Upvotes: 0
Views: 117
Reputation: 780673
I think this will do it:
find . -type f -name '*.php' -exec awk '/<\?/,/\?>/ && /eval/' {} \;
/<\?/,/\?>/
specifies the range of lines between <?
and ?>
.
Upvotes: 2