Extracting emails with top level domains from a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kelvin789
    New Member
    • Nov 2020
    • 1

    Extracting emails with top level domains from a file

    I'm trying to extract only emails with top level domains from a file using a bash script. For example: test@email.com or test@email.uk would be picked up but test@email.co.u k would not be picked up. This is what I've tried to no avail:

    rep -E -o '[a-zA-Z0-9._-]+@[a-zA-Z0-9_-]+\.[a-zA-Z0-9]{2,}' myfile.html
  • SioSio
    Contributor
    • Dec 2019
    • 272

    #2
    grep -E "[-_a-zA-Z0-9\.+]+@[-a-zA-Z0-9\.]+" myfile.html

    Comment

    Working...