Hmm,
that's not too difficult.
define a hash, loop the list, grab the values ( /(\S+)\s+(\S+)/ ), add
$2 to $hash{$1} and you'll have your 2 values waiting in the hash.
Here's an awk example that does the same. Sort your lines and pipe them
to this command:
awk 's==/^$/{l=$1;s=0}$1!=l{printf "%s %.0f\n",l,s;l=$1;s=0}$1==l{s +=
$2}END{printf "%s %.0f\n", l,s}'
Serge.
-----Original Message-----
From: Cassie Bezuidenhout [mailto:[EMAIL PROTECTED]
Subject: [rrd-users] Re: QOS Help
I manage to get all the right values but my results looks something like
this...
$Value1 $Value2
jhbfdx1interlocq 3752568281
jhbfdx1interlocq 3752042674
jhbfdx1interlocq 1901157205
jhbfdx1interlocq 1899725097
jhbvolinterlocq 1586152685
jhbvolinterlocq 1583119059
jhbvolinterlocq 2706518142
jhbvolinterlocq 2706787396
I need to add the second values up when the first values are the same to
pass onto my RRD. Any idea how to do this with perl
-------------
Op de inhoud van dit e-mailbericht en de daaraan gehechte bijlagen is de inhoud
van de volgende disclaimer van toepassing:
http://www.zeelandnet.nl/disclaimer.php
--
Unsubscribe mailto:[EMAIL PROTECTED]
Help mailto:[EMAIL PROTECTED]
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi