Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for a specific word 2

Status
Not open for further replies.

openeratech

Technical User
May 23, 2005
62
IN
Hi,

After doing lot of search i am writing this post.
I am using RH linux 7.3 and want to look for a file which has a specific word.

My scenario is, I am looking for a file which has the word "Spammers", but i dont know which file and under which directory. I remember in windows you can search for files containing specific word. But i dont know the command in Linux.

Please help.
 
Have you tried grep (as in grep 'Spammers' * to search all files. Note that this might cause problems if non-text files are searched). You could try a find:

find / -type f | xargs grep 'Spammers'

to search down through the directories under /
 
what you want is grep -lir spammers. grep will start searching from your current location. If you want to search your whole system, grep from /.


--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
 
Oops forget the *... that should be grep -lir spammers *.


--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
 
thanks a lot for both of you in helping me.
It really helped me.

Cheers

-Yunus
 
another search that I've used for years would be

find . -name "*" -exec grep -l -i "spammers" {} \;
 
aisne :

I think zeland's suggestion is a lot cleaner, no ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top