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...:
Extracts the IP addresses from the received headers of the messages and extract domains from the body of the messages

 



relroy
Novice

Apr 15, 2010, 8:05 PM

Post #1 of 3 (2216 views)
Extracts the IP addresses from the received headers of the messages and extract domains from the body of the messages Can't Post

I have a directory with 1000 files which contain email msgs .
Aim is to extract the IP addresses from the received headers of the messages and extract domains from the body of the messages to give output as below:-
File: filename2
IP: 12.2.3.40
Domain: domain2.com
Domain: domain3.com

Current code gives the filenames but isnt extracting IP address from the files, says uninitialized $_
-----------------------------------------------------------
#!C:/strawberry/perl/bin/perl
#directory.plx

use strict;
use warnings;

chdir("C:/Documents and Settings/Administrator/Directory101") or die "$!";
opendir (DIR, ".") or die "$!";
my @files = readdir DIR;
close DIR;

local @ARGV = @files;
foreach $ARGV (sort @ARGV)
{
print "Filename: $ARGV \n";
if (m /^d(,3)\.\d(1,3)\.\d(1,3)\.\d(1,3)\$/)
{
print "IP Address: $_ \n";
}
}


Any tips would be welcome. Thank you!


FishMonger
Veteran / Moderator

Apr 16, 2010, 6:08 AM

Post #2 of 3 (2206 views)
Re: [relroy] Extracts the IP addresses from the received headers of the messages and extract domains from the body of the messages [In reply to] Can't Post

For those who may post a response, this is a homework assignment which is already being worked on.

http://perlguru.com/gforum.cgi?post=45826


relroy
Novice

Apr 16, 2010, 6:34 AM

Post #3 of 3 (2203 views)
Re: [FishMonger] Extracts the IP addresses from the received headers of the messages and extract domains from the body of the messages [In reply to] Can't Post

--- Thread closed ---

 
 


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

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