The dig +short
command (such as described in "dig show only answer") is great for batch processing names into IP addresses. It does a simple job and does it well.
Unfortunately when there's a CNAME even +short
isn't short enough. For example:
$ dig +short docs.sbonds.org
ghs.google.com.
173.194.69.121
I've tried +noall
but it doesn't seem like it changes the behavior of +short
. I've also tried specifying -t a
just to ensure it didn't think I meant an A record or CNAME, but that (unsurprisingly) changes nothing.
$ dig +noall +short docs.sbonds.org
ghs.google.com.
173.194.69.121
I'm using RedHat 7's dig
:
# dig -v
DiG 9.9.4-RedHat-9.9.4-73.el7_6
I can filter out the CNAMEs with trusty grep
, but it seems like dig should have some way to give "Just the IP, ma'am."
What is that way?