#!/bin/rc hget https://www.internic.net/domain/named.root | awk ' BEGIN {i = 0;} /^;$/ {next;} /^; ./ { comment = substr($0, 2); } { if ($3 == "NS") { NSes[i++] = $4; roots[$4,"comment"] = comment; } else if ($3 == "AAAA") { roots[$1,"ipv6"] = $4; } else if ($3 == "A") { roots[$1,"ip"] = $4; } } END { print "dom=" for (j = 0; j < i; j++) { r = NSes[j] print " ns=" substr(r, 1, length(r)-1); } for (j = 0; j < i; j++) { r = NSes[j]; print "dom=" substr(r, 1, length(r)-1), "ip=" roots[r,"ip"], (length(roots[r,"ipv6"])? ("ipv6=" roots[r, "ipv6"]) : ""), "# " roots[r, "comment"] } }'