Created
September 16, 2012 10:07
-
-
Save martinmev/3731861 to your computer and use it in GitHub Desktop.
Script gets email addresses from the text (first argument). Emails are written to the output file (second argument).
This file contains 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
#!/usr/bin/env python | |
import sys | |
import re | |
getEmails = re.compile(r'[\w\-][\w\-\.]+@[\w\-][\w\-\.]+[a-zA-Z]{1,4}') | |
content=open(sys.argv[1],'r').readlines() | |
found = set() | |
for c in content: | |
found.update(getEmails.findall(c)) | |
out = open(sys.argv[2],'w') | |
for f in found: | |
out.write(str(f)+'\n') | |
out.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment