I am trying to come up with an egrep command that can do pattern match a set of strings and variables. So far, I am using the following:
ps -ef <uid> | egrep "string1|string2" | egrep -v "string4|string5" | grep -v "${variable}"
This works, but I am trying to have a syntax that is uniform and efficient.
I could get the following command work on Linux but not on AIX:
ps -ef <uid> | egrep "string1|string2" | grep -v "${variable}\|string4\|string5"
I have gone through the man pages and tried egrep -c and such but could not make any combination work.