die "perl port-state-service+IP-disk-goto-2.pl " if $#ARGV < 2; open(F0, $ARGV[0]); open(F1, $ARGV[1]); open(F2, ">$ARGV[2]"); $line_no=$line_stop=0; print F2 "IP\t\tport\tstate\tprotocol\n\n"; label: if ($_ = ) { while (s/^[\ \t]//g) {}; while (s/[\ \t]$//g) {}; s/\r\n//;s/\t+/\t/;chomp; if (/^[0-9]+/) { $line_port=$'; $line_no=$&; goto get_IP; CONT: } goto label; } close F0; close F1; close F2; goto END; get_IP: while (($line_stop < $line_no) && ($line_IP = )) { $line_stop++ if $line_IP =~ /[0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9]/; } if ($line_stop == $line_no) { $line_IP =~ s/^[\t\ ]+//g;$line_IP =~ s/[\t\ ]+$//g ;$line_IP =~ s/\n$//g; $line_port =~ s/^[\t\ ]+//g;$line_port =~ s/[\t\ ]+$//g ; print F2 "$line_IP\t$line_port\n"; goto CONT; } goto CONT; END: