Linux : find & grep

Solved
Hello,

you need to use the following command with grep and find:
display the names of files that contain the word "premier" starting from your "home" folder.

I tried with: find ~ -name * -print -exec grep "premier"

but I'm only able to display the lines... how can I display the file names?
Configuration: Windows XP Firefox 3.0.1

9 answers

  1. Hello,

    this one should work too:

    find . -type f -name "*.php" -exec grep -il 'pattern' {} \;


    or this one:

    find . -name "*.php" -print0 | xargs -0 egrep pattern


    ^ ^
    --
    a penguin on the ice floe!
    1. You're welcome ;)