maikelnight has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks, i have an array with Strings, which looks like:
$VAR1 = 'Nov 19 06:31:17 proxy postgrey[2439]: action=pass, reason=tri +plet found, client_name=r41.newsletter.otto.de, client_address=185.15 +.51.41, sender=otto@newsletter.otto.de, recipient=some.one@some.domai +n'; $VAR2 = 'Nov 19 06:37:45 proxy postgrey[2439]: action=pass, reason=tri +plet found, client_name=uspmta194080.emarsys.net, client_address=217. +175.194.80, sender=suite17@xpressus.emarsys.net, recipient=other.one@ +some.domain';
I need to push some strings from the array into another array - for example the date, sender and recipient. I first try with date, like:
for my $x ( @results ) { chomp $x; my ($date) = split /'[A-z]*.[0-9]*.[0-9]*:[0-9]*:[0-9]*/, $x; push @out, $date; }
What results in the whole line:
May i ask someone to shed some light, please! Thanks!$VAR1 = 'Nov 19 06:31:17 proxy postgrey[2439]: action=pass, reason=tri +plet found, client_name=r41.newsletter.otto.de, client_address=185.15 +.51.41, sender=otto@newsletter.otto.de, recipient=some.one@some.domai +n';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array of strings search
by hippo (Archbishop) on Nov 23, 2017 at 15:58 UTC | |
|
Re: Array of strings search
by Laurent_R (Canon) on Nov 23, 2017 at 17:21 UTC | |
|
Re: Array of strings search
by AnomalousMonk (Archbishop) on Nov 23, 2017 at 18:04 UTC | |
by maikelnight (Sexton) on Nov 23, 2017 at 20:35 UTC | |
by Laurent_R (Canon) on Nov 24, 2017 at 00:09 UTC | |
by AnomalousMonk (Archbishop) on Nov 23, 2017 at 22:32 UTC | |
|
Re: Array of strings search
by karlgoethebier (Abbot) on Nov 24, 2017 at 11:53 UTC | |
|
Re: Array of strings search
by Marshall (Canon) on Nov 27, 2017 at 20:57 UTC |