Re: parsing report
- From: boyd <tbmoore9@xxxxxxxxxxx>
- Date: Fri, 24 Nov 2006 21:22:45 GMT
In article <1164392103.945228.116470@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
ccandillo@xxxxxxxxx wrote:
DJ Stunks wrote:
ccandillo@xxxxxxxxx wrote:
I have a report that looks like the following. I am tring to add up
the disk space, total and used. Using regular expressions, I know how
to find the information that I am looking for but I do not know how to
add them up. Do I store them in hashes, arrays?
it depends how you want them grouped.
by server? (suggestion: hash of hashes)
by server and volume? (suggestion: hash of hashes of hashes)
not at all - ie: two totals? (suggestion: hash)
some other scheme? (suggestion: provide more information)
-jp
By server. If I can do that, then I would be able to create a final
total as well.
You can add the values to this kind of hash:
my %stats;
# in your loop that reads through the report and captures $server,
# $total, and $used
$stats{$server}->{total} += $total;
$stats{$server}->{used} += $used;
# at the end:
for my $server( sort keys %stats ){
print "For server $server\n";
print "\tTotal =\t$stats{$server}->{total} "
. "\tUsed =\t$stats{$server}->{used}\n";
}
Boyd
.
- References:
- parsing report
- From: ccandillo
- Re: parsing report
- From: DJ Stunks
- Re: parsing report
- From: ccandillo
- parsing report
- Prev by Date: Re: Re: commit
- Next by Date: goto return ?
- Previous by thread: Re: parsing report
- Next by thread: parsing report
- Index(es):
Relevant Pages
|