CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



benjaminlawrie
Deleted

Nov 14, 2000, 10:13 PM

Post #1 of 2 (1182 views)
email extractor Can't Post

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.


sleuth
Enthusiast

Nov 15, 2000, 11:39 AM

Post #2 of 2 (1182 views)
Re: email extractor [In reply to] Can't Post

 
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>




#!/usr/bin/perl
# 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!!;
push(@addys,"$addy\n");
}
}
close(data);
if (!$append){
open(file, ">$done_file");
print file @addys;
close(file);
}
else{
open(file, ">>$done_file");
print file @addys;
close(file);
}
$count=@addys;
print qq~<p algin="left"><font face="verdana" color="880000" size="2">Finished:<br>"$count" Email address found.</font></p>~;
exit;


</pre><HR></BLOCKQUOTE>

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives