I would like to validate emails from text files in a directory using bash
.
My regex:
grep -Eoh \
"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,8}\b" * \
| sort -u > mail_list
This regex satisfies all my requirements but it cannot exclude addresses such:
^%&blah@gmail.com
and
with.dot@sale..department.company-name.com
(with 2 and more dots).
These kinds of addresses should be excluded.
How can I modify this regex to exclude these types of emails?
I can use only one expression for this task.