grep -P negative lookahead does not work [closed]

Bash is expanding the arguments before passing them to grep. Either escape the ! or use single quotes.

grep -oP '[A-Za-z0-9]{6}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2} =>.*@(?!gmail.com)' /var/log/exim/main.log-prueba

or:

grep -oP "[A-Za-z0-9]{6}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2} =>.*@(?\!gmail.com)" /var/log/exim/main.log-prueba