how to grep multiple files and return the files that contain a string - HP UX

This is a discussion on how to grep multiple files and return the files that contain a string - HP UX ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: how to grep multiple files and return the files that contain a string

  1. how to grep multiple files and return the files that contain a string

    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.


  2. 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.

  3. Re: how to grep multiple files and return the files that contain a string

    doh! any closer it would have bit me... I had an Andromeda Strain
    moment reading the man page. Much obliged.


+ Reply to Thread