#!/usr/bin/perl -w use strict; # 15:20:56.789680 P 0:48:54:5c:4d:f1 0:0:0:0:0:1 ip 1514: wsrppp15.wsr.ac.at.1605 > 195.202.170.227.smtp: P 420284195:420285643(1448) ack 3689574287 win 32120 (DF) my %octets; while (<>) { if (/([\d.:]+) ([\w:]+) ([\w:]+) ip (\d+): ([-\w.]+)\.(\w+) > ([-\w.]+)\.(\w+):/) { # print; # print "-> $1 $2 $3 $4 $5 $6 $7 $8\n"; my $octets = $4; my $sip = $5; my $sport = $6; my $dip = $7; my $dport = $8; # print "-> proto = $proto\n"; $octets{"$sip - $dip"} += $octets; } } for my $i (sort { $octets{$a} <=> $octets{$b} } keys %octets) { printf "%10d %s\n", $octets{$i}, $i; } #vim:sw=4