You can make use of egrep
, which per definition is the same as grep -E
. It interprets the patterns as extended regular expressions, so that grep -E "hello|hi"
means: "grep either hello
or hi
".
So both of these should work:
echo "Hello hi" | egrep -i "hello|hi" # as you are using -i, no need to low/upper case
echo "Hello hi" | grep -Ei "hello|hi"
In case of doubt, you can always check your man grep
and see what they explain there. As I do not have access to any Solaris server, I cannot test myself.