Magic Banana's fourth script in his June 23 (17:00) works convincingly

OK. However I realized I was lying when I wrote that "the output is correct when the PTR contains digits before the actual address (...)". Everything up to the last digit before the address was not removed. Here is a similar solution that does not suffer from that problem and that is nicer, thanks to AWK's FPAT variable:

awk -v FPAT='[0-9]{1,3}[^0-9]{1,5}[0-9]{1,3}[^0-9]{1,5}[0-9]{1,3}[^0-9]{1,5}[0-9]{1,3}' '$1 { printf $0 " "; gsub(/[^0-9]+/, ".", $1) } { print }' IPv4-SourceList.txt

No second column means no address was found in the PTR, in the first column. As I have already explained, the "5" can be tuned: it controls a trade-off between precision and recall.

Reply via email to