I work for a company that offers webhosting and DNS services. We are trying to migrate everything over to new servers and we've often run into stale zonefiles on our servers as customers have changed their authoritative servers to someone else.
I am trying to write a script that will check whois, ns, and SOA information to determine if a domain still uses us as an authoritative server.
I am attempting to use SED to filter the output of the following to display only the nameserver without the trailing ".":
dig +noall +answer soa yahoo.com | sed 's/.*SOA\s*//' | sed 's/\.$//'
I've searched the net, but most SED command examples show out to count "lines" instead of "Words".
The desired output would be as follows:
$ dig +noall +answer soa yahoo.com | sed '<Some SED code here>'
ns1.yahoo.com
Any suggestions would be helpful.