#!/usr/bin/perl $ACCT = @_; # Print the 'in' traffic for eth2 open $ACCT, "/home/mrtg/iptables_list"; while (<$ACCT>) { next unless s{^Chain INPUT .*$}""g; while (<$ACCT>) { last if $_ =~ /^\n/; next unless s{^ *[0-9]+ +([0-9]+) E2_I .*$}"$1"g; print; } break; } close $ACCT; # Print the 'out' traffic for eth2 open $ACCT, "/home/mrtg/iptables_list"; while (<$ACCT>) { next unless s{^Chain OUTPUT .*$}""g; while (<$ACCT>) { last if $_ =~ /^\n/; next unless s{^ *[0-9]+ +([0-9]+) E2_O .*$}"$1"g; print; } break; } close $ACCT; print "0\n"; print "Total Traffic Statistics - Bytes\n";