How to find a file with a string in it?

Friendly, civilized conversation about life the universe and everything.

Moderator: Moderators

Post Reply
User avatar
harsini
Posts: 84
Joined: Mon Jul 22, 2013 9:59 am
Location: Iran

How to find a file with a string in it?

Post by harsini »

Hi everybody.
How can I find a file with a specific string in it?I searched web but non of the command work in OpenWRT world e.g.:
find . -iname '*php' | xargs grep 'string' -sl
or grep -R. :roll:

ispyisail
Moderator
Posts: 5185
Joined: Mon Apr 06, 2009 3:15 am
Location: New Zealand

Re: How to find a file with a string in it?

Post by ispyisail »


User avatar
harsini
Posts: 84
Joined: Mon Jul 22, 2013 9:59 am
Location: Iran

Re: How to find a file with a string in it?

Post by harsini »


I think I should search within a path not on whole device.Because I tried to use grep and other similar commands to search a file with a string in whole device and that was unsuccessful .
Thanks

oliver
Posts: 48
Joined: Wed Jun 04, 2014 7:30 pm

Re: How to find a file with a string in it?

Post by oliver »

harsini wrote:Hi everybody.
How can I find a file with a specific string in it?I searched web but non of the command work in OpenWRT world e.g.:
find . -iname '*php' | xargs grep 'string' -sl
or grep -R. :roll:

Code: Select all

find . -type f -iname '*php' -exec grep -li 'string' {} \;

Post Reply