grep recursively in a directory

Hi,

how to grep recursively in a directory on Solaris OS.
grep -r throws an error that -r is an invalid option.

Please tell me if you have any solution.

Regards,
Jeevan.

ps.
I searched this forum for solution, but could not find anything useful.

grep can not be recursively executed.

use

find /yourpath/  -type f -exec grep -l pattern {} \;

This is a Gnu grep extension.

If you have Solaris 10, Gnu grep might be already installed in /usr/sfw/bin/ggrep.

If you have an OpenSolaris based distribution, it should be in /usr/gnu/bin/grep.

I'd strongly recommend using GNU grep. If that's simply not possible, see How can I recursively grep through sub-directories?

If for some reason Gnu grep is not available on your OS, a simple and efficient alternative would be:

find /yourpath -type f -exec grep -l pattern /dev/null {} +