in reply to Array of strings search
Cut it into pieces if you hate the regexes:
#!/usr/bin/env perl use strict; use warnings; use Data::Dump; use feature qw(say); my $string = q(Nov 19 06:37:45 proxy postgrey[2439]: action=pass, reason=triplet fo +und, client_name=uspmta194080.emarsys.net, client_address=217.175.194 +.80, sender=suite17@xpressus.emarsys.net, recipient=other.one@some.do +main); my @fields = split /action=|reason=|client_name=|client_address=|sender=|recipien +t=/, $string; my $date = ( split / proxy.+/, ( shift @fields ) )[0]; say $date; for ( 0 .. scalar @fields - 1 ) { $fields[$_] =~ s/, //; say $fields[$_]; } __END__ karls-mac-mini:monks karl$ ./split.pl Nov 19 06:37:45 pass triplet found uspmta194080.emarsys.net 217.175.194.80 suite17@xpressus.emarsys.net other.one@some.domain
I'll burn for this.
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help
|
|---|