Created
September 14, 2013 03:12
-
-
Save dkolb/6558522 to your computer and use it in GitHub Desktop.
A blatant abuse of map and Perl Hash/Array quirks to parse some output.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Data::Dumper; | |
$reports = [ | |
'16:02:10,663 INFO [log] STNDRDTESTRESULT operation=getEntityA,endpoint=http://server01.example.com/SomeService,status=VALID', | |
'16:02:18,485 INFO [log] STNDRDTESTRESULT operation=getEntityB,endpoint=http://server01.example.com/SomeOtherService,status=VALID', | |
'16:02:18,490 INFO [log] STNDRDTESTRESULT operation=getEntityB,endpoint=http://server02.example.com/SomeOtherService,status=VALID', | |
'16:02:20,657 INFO [log] STNDRDTESTRESULT operation=getEntityB,endpoint=http://server03.example.com/SomeOtherService,status=VALID', | |
'16:02:20,657 INFO [log] STNDRDTESTRESULT operation=getEntityB,endpoint=http://server04.example.com/SomeOtherService,status=VALID', | |
'16:02:22,276 INFO [log] STNDRDTESTRESULT operation=getEntityB,endpoint=http://server05.example.com/SomeOtherService,status=VALID', | |
'16:02:22,277 INFO [log] STNDRDTESTRESULT operation=getEntityB,endpoint=http://webservices.example.com/SomeOtherService,status=VALID' | |
]; | |
@processed = map { | |
s/^.* STNDRDTESTRESULT (.*)$/\1/; | |
my @kv = split ','; | |
my %m = map { split "=" } @kv; | |
\%m; | |
} @$reports; | |
print Dumper(\@processed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment