#!/usr/local/bin/perl -w $rep = "/tmp"; $base = "/appli/ipacc"; #@pool = ('lcvt017','lzdg003','lzdg003','lmhg016','lpar1037','lnrk005','lpar640'); @pool = ('lcvt017'); foreach $router (@pool) { $datafile = "$router.txt"; open(INPUT,"$rep/$datafile"); while () { if (not (/^###.*/)) { ($src, $dst, $packets, $bytes) = split ; $$summary{$src}{$dst} += $bytes; # $ip_src_list{$src}++; $ip_src_list{$src} += $bytes; $ip_dst_list{$dst}++; } } close(INPUT); #printf "%18s %18s %18s\n", "IP Source", "IP Destination", "Total Bytes"; foreach $ipsrc (keys %ip_src_list) { foreach $ipdst (keys %ip_dst_list) { if ($$summary{$ipsrc}{$ipdst}) { $tt{"$ipsrc -> $ipdst"} = $$summary{$ipsrc}{$ipdst}; #printf "%18s %18s %18s\n", $ipsrc, $ipdst, $$summary{$ipsrc}{$ipdst}; } } } @list_of_keys = keys %tt; foreach $key (sort keys %tt) { printf "%35s %15d\n",$key, $tt{$key}; }