Created
January 2, 2016 21:31
-
-
Save ziguane/9fca614558362d589863 to your computer and use it in GitHub Desktop.
A perl script to extract email addresses from a text file. I use this when cleaning up bounced / undeliverable messages from the mailq. The email_to_delete.txt file is a text file that contains text + email addresses. Once the email addresses are extracted to delete_these.txt, I build an SQL query to remove them from the database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -ne'if(/[\w\.\-\_]+@([\w\-\_]+\.)+[A-Za-z]{2,4}/g){print "$&\n"}' email_to_delete.txt | sort | uniq > delete_these.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment