Você pode usar -P
flag para perl regex e -i
para maiúsculas e minúsculas:
grep -Pi "[A-Z0-9][\w.%+-]+(?:@|@|\(at\)|\[at\]|%26%23064%3B|%40)[A-Z0-9][A-Z0-9.-]+\.[A-Z]{2,6}"
\w
significa [a-zA-Z0-9_]
Explicação:
[A-Z0-9] : 1 alphanum
[\w.%+-]+ : 1 or more alphanum, _, ., %, + or -
(?: : start non capture group
@ : literally @
| : OR
@ : html entity for @
| :
\(at\) :
| :
\[at\] :
| :
%26%23064%3B :
| :
%40 :
) :
[A-Z0-9] : 1 alphanum
[A-Z0-9.-]+ : 1 or more alphanum, . or -
\. : a dot
[A-Z]{2,6} : 2 upto 6 alpha (be aware that TLDs may have much more characters, see: https://www.iana.org/domains/root/db)
Resultado para o exemplo dado:
grep -Pi "[A-Z0-9][\w.%+-]+(?:@|@|\(at\)|\[at\]|%26%23064%3B|%40)[A-Z0-9][A-Z0-9.-]+\.[A-Z]{2,6}" file.txt
info@example.com
[email protected]
info(at)example.com
info[at]example.com
info%26%23064%3Bexample.com
info%40example.com