try leaving out the "cat": (assuming you are in the directory you want to search through):
grep "my-string" *.conf should come back with all occurances with the file name pre-pended. > -----Original Message----- > From: Mark D Pace [mailto:[EMAIL PROTECTED] > Sent: Friday, October 1, 2004 03:06 PM > 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
