die "perl port-state-service+IP-mem-list-indirect.pl " if $#ARGV < 2; sub idx { print F2 $IP[$line_no - 1], "\t$line\n" } open(F0, $ARGV[0]); open(F1, $ARGV[1]); open(F2, ">$ARGV[2]"); $line_no=0; while () { while (s/^[\ \t]//g) {}; while (s/[\ \t]$//g) {}; s/\r\n//;chomp; push @IP,$& 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"; 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 ; &idx; } close F0; close F2;