Skip to content

Instantly share code, notes, and snippets.

@rbocchinfuso
Created September 30, 2014 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbocchinfuso/8785c6ad944aeac4ec6b to your computer and use it in GitHub Desktop.
Save rbocchinfuso/8785c6ad944aeac4ec6b to your computer and use it in GitHub Desktop.
Parse mmifo xml output
#!/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