extracting emails from a file

i have a large html file that has emails
like something@domain.com
and something[at]domain.com

how can i print the emails? its fine if duplicates show up and it doesnt need to save into a file or anything, just whatever is the easiest way to make some basic code for this

thanks! :slight_smile:

You mean email addresses? Try:

grep -o '[^ \t]*@[^ \t]*' file

Could try this, (should pickup most valid email addresses):

sed s'/\[at\]/\@/' infile | grep -oE '\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b'