On Linux machines I use this syntax, in order to match all VALID ip's.

My question: what needs to change for egrep command in order to run the egrep on Solaris?

According to egrep manual page "-o" isn't a legal option.

What is the alternative for Solaris?


     egrep  -o  `echo $regex` file

example of file

  • I believe you missed a $ sign: echo $regex – jippie Nov 15 '12 at 20:21

On my Solaris systems, even the xpg4 version of grep does not include the -o option.

But if you have the SUNWggrp package installed, you'll find GNU egrep available as /usr/sfw/bin/gegrep.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.