Egrep: conflicting matchers specified

This bit of code works fine:

egrep -i '^rmcat' /etc/oratab |\
  awk -F\: '{print $1}'|\
while read ORACLE_SID
do

But when I modified it, thus:

egrep -v '^#' /etc/oratab |egrep -v '^$' | egrep -v '^listener' \
  awk -F\: '{print $1}'|\
while read ORACLE_SID
do

It produces the error

egrep: conflicting matchers specified

Hi, a pipe appears to be missing:

egrep -v '^listener' |\
2 Likes

Missing pipe was it. I figured it would be something simple where I just needed another set of eyes. Thanks.

You can consolidate

egrep -v '^#' /etc/oratab | egrep -v '^$'

into

egrep '^[^#]' /etc/oratab

And the whole thing into awk

awk -F: '/^[^#]/ && !/^listener/ {print $1}' /etc/oratab |
while read ORACLE_SID
do

Or into the shell

while IFS=":" read ORACLE_SID junk
do
  case $ORACLE_SID in
  ""|"#"*|listener*) continue ;;
  esac
  ...
done < /etc/oratab
1 Like