View Single Post

   
  #2 (permalink)  
Old 01-16-2008, 08:22 PM
Frank Slootweg
 
Posts: n/a
Default Re: how to grep multiple files and return the files that contain a string

mdevenney1@comcast.net wrote:
> this may be a dumb question, but I'm drawing a blank: I need to grep
> for a string across multiple files, and return the filename of the file
> in which the string used in the grep was found. Grep'ing across
> several files using wildcards for the filename parameter returns for me
> the string I'm searching for, but what I actually need is the name of
> the file that contains the string. Any tips would be greatly
> appreciated.


See the grep(1) "-l" ('ell', not 'one') option:

G> l Only the names of files with matching lines are listed (once),
G> separated by newlines. If standard input is searched, a path
G> name of - is listed.
Reply With Quote