GREP Command to Extract Email Addresses from EML Files

I have a directory with thousands of EML files that are essentially bounce messages. I want to extract all of the email addresses from these bounce messages to make changes to the relevant accounts.

This can be done with grep but navigating to the directory where all the EML files are located and then:

grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' *.eml | sort | uniq -i > emails.txt

Learn By Example: CLI Text Processing with GNU grep and ripgrep

Sundeep Agarwal’s Learn By Example series of ebooks is an invaluable source for learning programming and CLI text processing.

Earlier this year, Agarwal updated his CLI text processing with GNU grep and ripgrep ebook, adding a new chapter devoted to ripgrep.

Agarwal is generous in making his book available to read online, but he also makes his books available as PDF/EPUB for an extremely reasonable price.