#
# doc9-1.awk
#
# Distributed with: Doc - Version 2.0 (8/22/90)
# USC Information Sciences Institute
#
# Modified for BIND 9's soa format (jag 20010323)
#
# Accepts as input, output from dig querying for SOA of a domain.
# Expects input to be lower case.
#
# Prints serial # of SOA (only one)
# Exit status indicates:
# o response was authoritative (or not)
# o number of SOA records found
#
BEGIN {aa=0; ss=0}
/flags:/ && /aa/ {aa++}
$4 == "soa" {soa=$7; ss++}
END {
print soa
if (aa==0)
{ss=0-ss};
exit(ss);
}
syntax highlighted by Code2HTML, v. 0.9.1