grep Solaris Recursive Search Not Working – Troubleshooting Guide

greprecursivesolaris

On our Solaris server I'm finding that grep -r doesn't work, which is the usual way that I use grep. It seems that egrep has the same behavior.

Given that I have no control over the machine, is there a way to have grep perform a recursive search? Or do I need to pipe the output of find into grep?

Best Answer

I'm not familiar with Solaris, but if you're switching from GNU/linux to Solaris you'll find most of the commands will behave slightly different. The GNU version of Unix tools have additional features missing in "proprietary" Unixes.

You can download GNU grep(s) here then compile and install.

If you do have root access you might want to run configure --prefix=/usr/local Such that the utilities install into /usr/local

If you do not have root access you might want to run configure --prefix=${HOME} Such that the utilities install into your home directory

Related Question