Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello Monks

I really did not want to ask this but i am really stuck and have no way out so desperately in need of some guidance. I'm trying to create a script that read a large file of sendmail log, store it in $HoAoA and grep the email address entered from prompt and return all the entries related to that email based on the $id. This is what i have now.

#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper; <
my %HoAoA;
while ( <DATA> ) {
my @fields = split(/:,\s+/, $_, 4);
push @{ $HoAoA{$fields1} }, [ @fields0,2,3 ];
}
my @addresses;
foreach my $id ( keys %HoAoA ) {
if ( grep(/econgame\@worldgameofeconomics.com/, $HoAoA{$id}->[0]1, $HoAoA{$id}->11) ) {
push @addresses, $HoAoA{$id}->[0]1, $HoAoA{$id}->11;
}
}

__DATA__
Dec 8 08:49:21 b.mx.sonic.net sm-mta18242: jB8GnCuK018242: from=<cj@oreilly.com>, size=10731, class="0", nrcpts=2, msgid=<E4461FEB-1B74-4612-80DC-3A39B04D89B1@oreilly.com>, proto=ESMTP, daemon=MTA, relay=mwest.oreilly.com 209.204.146.24
Dec 8 08:49:21 b.mx.sonic.net sm-mta17961: jB8Gn2v5017961: lost input channel from 200216009099.user.veloxzone.com.br 200.216.9.99 to MTA after rcpt
Dec 8 08:49:21 b.mx.sonic.net sm-mta17961: jB8Gn2v5017961: from=<je-hurn@mamma.com>, size=0, class="0", nrcpts=0, proto=SMTP, daemon=MTA, relay=200216009099.user.veloxzone.com.br 200.216.9.99
Dec 8 08:49:21 d.mx.sonic.net sm-mta6438: jB8Gn1iU006438: Milter: to=<econgame@worldgameofeconomics.com>, reject=550 5.7.1 Recipient declines mail from 221.233.54.253, (DUL), see http://www.mail-abuse.com/cgi-bin/lookup?ip_address=22 1.233.54.253
Dec 8 08:49:21 c.mx.sonic.net sm-mta30845: jB8GgMPb030845: from=<Michael@MichaelRomano.net>, size=2786810, class="0", nrcpts=0, proto=ESMTP, daemon=MTA, relay=b.mail.sonic.net 64.142.19.5
Dec 8 08:49:21 b.mx.sonic.net sm-mta18528: jB8GnCuK018242: to=<mkirk@corp.sonic.net>,<dane@corp.sonic.net>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=160731, relay=lds.sonic.net. 208.201.249.231, dsn=2.0.0, stat=Sent (jB8GnLpC004736 Message accepted for delivery)
Dec 8 08:49:21 a.mx.sonic.net sm-mta3699: jB8Gn9Vt003699: Milter: to=<cvd@sonic.net>, reject=550 5.7.1 Recipient declines email from 80.54.242.112, <spamhaus-xbl>, Ref: http://www.spamhaus.org/query/bl?ip=80.54.242.112 Dec 8 08:49:21 a.mx.sonic.net sm-mta3699: jB8Gn9Vt003699: lost input channel from host2-112.btk.net.pl 80.54.242.112 to MTA after rcpt
Dec 8 08:49:21 a.mx.sonic.net sm-mta3699: jB8Gn9Vt003699: from=<qfqsoftmtja@hotmail.com>, size=0, class="0", nrcpts=0, proto=SMTP, daemon=MTA, relay=host2-112.btk.net.pl 80.54.242.112

It works for some emails such as cj@oreilly.com but not for all. I really don't understand why. Please help. Thank you all.

In reply to Please help with %HoAoA by vboy1997

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-23 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found