My case was: Match all lines with key purgepolicy, but not containing the word Entirepool
purgePolicy=EntirePool
purgePolicy=FailingConnectionOnly
First I tried to use the ! operator in the regex, but that only causes the error
bash: !": event not found
Solution was to first find all lines with purgepolicy then pipe the result and exclude all results with EntirePool
grep "purgePolicy=" myfile.props | grep -v "EntirePool"
Solution found at http://www.thegeekstuff.com/2011/10/grep-or-and-not-operators/