Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: grep ALL files on a drive?< Next Oldest | Next Newest >
dallas7 Offline





Group: Members
Posts: 36
Joined: Sep. 2003
Posted: Nov. 25 2004,18:47 QUOTE

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!


--------------
Your Jedi mind tricks won't work on me, Skywalker.
Back to top
Profile PM 
skaos Offline





Group: Members
Posts: 430
Joined: April 2004
Posted: Nov. 26 2004,10:49 QUOTE

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?
Back to top
Profile PM 
Patrick Offline





Group: Members
Posts: 333
Joined: Sep. 2004
Posted: Nov. 26 2004,11:08 QUOTE

find . -name "*.file_extension" -exec grep "My_search_string" {} \; -print

(found this with google)


--------------
Usb-stick sandisk cruzer titanium 512 Mb:
DSL 2.3 (final)
Firefox (Mozilla 1.06)
WM -biff  -cdplay -clockmon -smixer -usic -top -net -biff -ifinfo -cpuload
gps vnc LinNeighborhood (samba) QtParted bdc
xawtv imagemagick xplanet
Back to top
Profile PM WEB 
skaos Offline





Group: Members
Posts: 430
Joined: April 2004
Posted: Nov. 26 2004,14:19 QUOTE

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.
Back to top
Profile PM 
3 replies since Nov. 25 2004,18:47 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: grep ALL files on a drive?

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code