Search email with grep in a file

Regex Pattern "\b[A-Za-z0-9._-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"

$ cat file.txt | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" > file2.txt

delete duplicate email:
$ cat file2.txt | grep sort -u > file3.txt

Leave a Reply

Your email address will not be published. Required fields are marked *