I call this findgrep:
#!/bin/sh -
if test $# -ne 2
then
echo "Usage: findgrep dir pattern"
exit -1
fi
find $1 -print | xargs grep $2 /dev/null
Note that the /dev/null forces grep to emit the filename even if find only finds one
file.
-----Original Message-----
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of
Mark D Pace
Sent: Friday, October 01, 2004 8:07 AM
To: [EMAIL PROTECTED]
Subject: Search script
Does some have a script they could share that would do the following
Search through a list of files ie. *.conf
Look for a particular string ie. 'virtual'
If the string is found I would like to display the line and filename that
contained that line.
I can do part of that by doing cat *.conf |grep string but that only
displays the line, not the file in which it was found.
Can someone help me out with the file name part?
Thanks very much.
Mark D Pace
Senior Systems Engineer
Mainline Information Systems
1700 Summit Lake Drive
Tallahassee, FL. 32317
Office: 850.219.5184
Fax: 888.221.9862
http://www.mainline.com
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390