stevbutt has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
Please help with some wise and efficient string matching wisdom
Input :
May 2 04:06:15 lon.mail.net exim[17905]: 2012-07-03 07:06:15 1SPPtO-0004en-PS <= me@ours.co.uk H=smtpout.mail.com [22.5.10.4] I=[6.5.14.4]:25 P=esmtp S=13333 id=6aeca3b79b8892d6105dab131c76f066@localhost.localdomain T="Half price offer"I want to grab the IP address ( 22.5.10.4 without the square brackets ) the email address ( me@ours.co.uk which always follows <= )
so far I have the ip address but with the square brackets using :
my ($srvrip) = $remainder =~ m/H=.+?(\[.+?\])/;How can I extract the email address ?
I have a lot of lines in the log files so need this to be as efficient as possible and am also restricted to perl 5.8.4
Hope you can help
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: String Matching
by davido (Cardinal) on Aug 14, 2012 at 01:51 UTC | |
by stevbutt (Novice) on Aug 14, 2012 at 08:12 UTC | |
by davido (Cardinal) on Aug 14, 2012 at 08:18 UTC | |
by stevbutt (Novice) on Aug 14, 2012 at 16:21 UTC | |
by AnomalousMonk (Archbishop) on Aug 14, 2012 at 16:41 UTC | |
by davido (Cardinal) on Aug 14, 2012 at 16:41 UTC | |
| |
|
Re: String Matching
by GrandFather (Saint) on Aug 14, 2012 at 01:12 UTC | |
by Steve_BZ (Chaplain) on Aug 14, 2012 at 18:02 UTC | |
|
Re: String Matching
by rpnoble419 (Pilgrim) on Aug 14, 2012 at 07:08 UTC | |
|
Re: String Matching
by 2teez (Vicar) on Aug 14, 2012 at 07:43 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |