Created
September 30, 2014 16:33
-
-
Save rbocchinfuso/8785c6ad944aeac4ec6b to your computer and use it in GitHub Desktop.
Parse mmifo xml 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
#!/opt/ActivePerl-5.16/bin/perl | |
use XML::Simple; | |
use Data::Dumper; | |
use IO::File; | |
open (OUTFILE, '>parsed_mminfo.csv'); | |
print OUTFILE "filename,client,name,level,sum-size\n"; | |
# create object | |
$xml = new XML::Simple (KeyAttr=>[]); | |
@files = </tmp/NW_mminfo/*.xml>; | |
foreach $file (@files) { | |
print "...processing $file\n"; | |
# read XML file | |
$data = $xml->XMLin("$file"); | |
foreach my $e (@{$data->{result}}) { | |
print OUTFILE "$file,"; | |
print OUTFILE | |
$e->{"client"} , "," , | |
$e->{"name"} ,",", | |
$e->{"level"} ,",", | |
$e->{"sum-size"} , ,"\n"; | |
} | |
} | |
close (OUTFILE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment