Source Destination Packets Bytes 15.254.32.120 10.2.9.2 5 504 209.68.19.130 10.2.9.2 33 15941 17.149.36.162 10.2.9.3 14 3416 17.149.36.15 10.2.9.3 14 3404 67.148.147.65 10.2.9.3 57 39207 8.8.8.8 10.2.9.6 84 8006 Accounting data age is 0w1d Box# #### #!/usr/bin/perl use warnings; use strict; my $tmpipaccountingfile = "tmpipaccountingfile"; my $DestDevice = "Box"; foreach my $OuterData () { print "OuterData = $OuterData"; open TMPIPACCOUNTINGFILE, "<", "$tmpipaccountingfile"; foreach my $Line () { chomp $Line; next if ($Line =~ m/^sh/); next if ($Line =~ m/^\s*Source/); next if ($Line =~ m/^$DestDevice/); next if ($Line =~ m/^Accounting/); next if ($Line =~ m/^$/); next unless ($Line =~ m/^\s*\d*.\d*.\d*.\d*\s*$OuterData/); print "Line = $Line\n\n"; } close TMPIPACCOUNTINGFILE; } exit; __DATA__ 10.2.9.2 10.2.9.3 10.2.9.6 #### OuterData = 10.2.9.2 Line = 8.8.8.8 10.2.9.6 84 8006 OuterData = 10.2.9.3 Line = 8.8.8.8 10.2.9.6 84 8006 OuterData = 10.2.9.6 Line = 8.8.8.8 10.2.9.6 84 8006 #### OuterData = 10.2.9.2 Line = 15.254.32.120 10.2.9.2 5 504 Line = 209.68.19.130 10.2.9.2 33 15941 OuterData = 10.2.9.3 Line = 17.149.36.162 10.2.9.3 14 3416 Line = 17.149.36.15 10.2.9.3 14 3404 Line = 17.149.36.15 10.2.9.3 14 3404 Line = 67.148.147.65 10.2.9.3 57 39207 OuterData = 10.2.9.6 Line = 8.8.8.8 10.2.9.6 84 8006