Ever wanted to extract e-mail adresses from eg. log files, or multiple files for later examination? this could be usefull if in a case where you need all valid email adresses� from a file that might contain invalid/fake adresses.
anyway, that was my case, so i thougt i’d share an easy way that extract email adresses� that contains upper and lowercase a-z, from 0-9 digit, dot (.), underscore (_) and hyphen (-), and finally, a 2-3 character tld.
it will also sort the output, and then only output multiple entries once.
egrep -oi ‘\b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}’ mail.log |sort |uniq > final_result.txt
#1 by jens on April 7, 2009 - 6:32 pm
Quote
Very handy, thx
only, your quotes used don’t work with copy pasting,
it say’s “‘” but my terminal requires “‘”
#2 by jens on April 7, 2009 - 6:33 pm
Quote
bah, the quote’s just get faulty rendered by your cms apparently, isn’t there a code tag?
#3 by jens on April 7, 2009 - 6:34 pm
Quote
Well, sorry, my bad, there is a code tag.
it say’s “‘†but my terminal requires “'â€#4 by admin on April 12, 2009 - 9:10 pm
Quote
i have noticed the exact same thing various other places, its annoying yea