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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find (containing text)

Status
Not open for further replies.

astin

MIS
Jun 20, 2002
87
GB
Hello
Please can someone let me know which is the correct find argument to find a file containing specific text (in the body - not the filename)
For example if I have a list of routers in text format, and I wish to search my unix box for all files containing the string 'router' , how could this be done.
I dont have the man pages installed on my box - and will not be able to install the disk for another 2 weeks,.
Any help appreciated.
A
 
Someone probably has a more elegant solution, but:

find . -name '*' -exec grep -l '<text to be found>' {} \;

seems to do what you want. Run it from the top level directory you wish to search down from.

Incidentally, there are plenty of online man pages - try Cheers.
 

In files directory or in the root of your search tree do a

find . -name &quot;*&quot; -exec grep -l SEARCHTEXT {} \; >filelist

That should do the trick..

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top