
relroy
Novice
Apr 15, 2010, 8:05 PM
Post #1 of 3
(3834 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!
|