One could use -v
to exclude a single word from a file, but I'm wondering why the regex pattern ?!
is not working with grep
/egrep
.
I was searching for a pattern to exclude a single word from my search in a file in atom
editor and found this link. The ?!
works perfectly in atom
. In bash
I had to turn off histexpand
with set +H
first, otherwise you get -bash: !xxx: event not found
as !pattern
searches the history. After that I tried stuff like echo "no" | grep "^(?!yes).*"
, but grep
does somehow not recognize the ?!
pattern - why is that so?