die "perl port-state-service+IP-mem-hash-direct-delete-xtra-ARGV-line-IP-start.pl " if $#ARGV < 3; die "ARGV[3] MUST contain just a number: got =>$ARGV[3]<=" if $ARGV[3] =~ /[^0-9]/; open(F0, $ARGV[0]); open(F1, $ARGV[1]); open(F2, ">$ARGV[2]"); $line_no=$ARGV[3]; while () { while (s/^[\ \t]//g) {}; while (s/[\ \t]$//g) {}; s/\r\n//;chomp; $IP{$line_no++} = $& if /[0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9]/; } close F1; print F2 "IP\t\tport\tstate\tprotocol\n\n";$x = $y = 0; while () { while (s/^[\ \t]//g) {}; while (s/[\ \t]$//g) {}; s/\r\n//;s/\t+/\t/;chomp;/^[0-9]+/;$line=$';$line_no=$&; $line =~ s/^[\t\ ]+//g;$line =~ s/[\t\ ]+$//g ; $temp = delete $IP{$line_no - 1} if $IP{$line_no - 1}; $y = $line_no - 1; if ($y > $x) { for ($z = $x;$z < $y;$z++) { delete $IP{$z}; } } print F2 $temp, "\t$line\n" if /[0-9]+\//; $x = $y; } close F0; close F2;