Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
email extractor


Nov 14, 2000, 10:13 PM

Views: 1783
email extractor

I need a program to extract about 1000 email address's from a flat text file. The text file was my mailing list emails but the script went a bit wierd and has added alsorts of random letters in there as well.
it looks something like this now;
fjfjdjl;d;' email@email.com kdkdkdkksjs email2@email2.com dwnefe etc.

freeware would be good.


Nov 15, 2000, 11:39 AM

Views: 1783
Re: email extractor

I thought this would be a usefull little script so I wrote one for your needs.

Did you happen to get the other script working?

Edit my post to cut & paste the following code.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

# Addy Seeker 1.0
# --- Author --- #
# Sleuth
# Contact: Sleuth@seeki.com
# --- Copywrite --- #
# GNU Public License
# --- Installation --- #
# Upload, chmod, configure variables accordingly
# must be uploaded in ascii mode
# You must have an ftp client, if you don't have one go to "http://www.kis21.com/~hdlim/" and click downloads at the left
# Or, search for "best ftp" at tucows.com and you can get the same one, it's a very good ftp client.
# --- Notes --- #
# Requested by benjaminlawrie at the perlguru.com forums
# Please visit perlguru.com for all of your perl needs & questions
# Perldomain.com coming soon as of now, great scripts done professionally and custom programming will be available
# ---- End --- #
print "Content-type: text/html\n\n";
$htmlfile = '/path/to/file.html'; # this is the file with the email addresses in it
$done_file = '/path/to/donefile.db'; # this is the file it will save the addys to, it must exist.
$append = "1"; # if this is 1 it will write the email addresses to the end of the $done_file, if it's nothing & just blank,
# it will overwrite the file everytime with the email addresses it finds from $htmllfile.
open(data, "<$htmlfile");
while(<data> ){
if ($_ =~ m,(\s.*?\@.*?\..+?\s), &#0124; &#0124; $_ =~ m,(^.*?\@.*?\..+?\s),){
($addy = $1) =~ s!^\s!!;
if (!$append){
open(file, ">$done_file");
print file @addys;
open(file, ">>$done_file");
print file @addys;
print qq~<p algin="left"><font face="verdana" color="880000" size="2">Finished:<br>"$count" Email address found.</font></p>~;