search for words in file

hi all,

i would like to search in a directory. all files they were found shoul be opend and looked about a keyword. if keyword is found i want to see the name of the file. i've rtfm of find and have a command like this :

find /etc -exec cat \{}\ | grep KEYWORD

but don't work, and :

find /etc -exec grep KEYWORD

or other will not work.. any ideas how to search ? perl isn't installed !

thanks
patrick

find /etc -name "*" -print|xargs grep "KEYWORD" |pg

Or try:

find /etc -exec grep KEYWORD {} \;
     or
find /etc | xargs grep KEYWORD

hi all,

a lot of thanks to all,

find /etc | xargs grep KEYWORD

was the right thing. have a nice day

patrick...

try

cat ` find . -type f -exec grep -l <KEYWORD> {} \;`

grep -l will print filenames with matching pattern only. Cat will open these files.

:wink: