grep ALL files on a drive?


Forum: Other Help Topics
Topic: grep ALL files on a drive?
started by: dallas7

Posted by dallas7 on Nov. 25 2004,18:47
While I think I understand the basics of grep, I just can't seem to figure out this:

I want to search ALL the files on my hard drive for a string of text, but I keep running into an "invalid argument."

I've tried
grep -r string /
grep -r string *
grep -r string /*
grep string -r
etc.
etc.

I'm pretty sure it can be done, but the syntax eludes me.  I've looked at alot of sites for help to no avail.  I'm not even sure if the string has to be bracketed by 'string' or "string"

What I'm tryng to find is the file that stores the data used by ath0 in my WiFi setup.  I'm assuming iwconfig writes that to something somewhere, just like ifconfig writes to etc/network/interfaces.  The text string I'm using is the ESSID which would seem to be a logical parameter to use in the search.

Thanks!

Posted by skaos on Nov. 26 2004,10:49
Try:
cd /
grep -F -r ath0 * | more
Ordinarily grep only looks for file names, the -F option makes it look for strings within the files.
BTW, I tried grep -r string * and it should look for files with the name "string" - is it a bug?

Posted by Patrick on Nov. 26 2004,11:08
find . -name "*.file_extension" -exec grep "My_search_string" {} \; -print

(found this with google)

Posted by skaos on Nov. 26 2004,14:19
Quote
Ordinarily grep only looks for file names

Quote
BTW, I tried grep -r string * and it should look for files with the name "string" - is it a bug?

Sorry, this is not correct - I was confusing grep with find.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.