I have found lots of guides for ignoring lines with comments or matching for one string but not another, but I have not found what I need. I want to grep recursively for files containing the string "indexes" (case insensitive i think, it's apache conf) but not a "#" BEFORE it.
It should match this:
Options Indexes Options +Indexes Options Indexes MultiViews Options Indexes # Comment Options Indexes # Indexes
But not this:
Options MultiViews # Indexes # Indexes yadayada Indexes
I'm using it in a script on the form:
if grep -re "[^#]*ndexes" $DIR1/httpd.conf $DIR2/http; then echo Do not use Indexes fi
The above is one of my efforts, but I cannot get it to work.