Simple dig output?

Posted by knocte on Server Fault See other posts from Server Fault or by knocte
Published on 2012-10-29T16:14:11Z Indexed on 2012/10/29 17:04 UTC
Read the original article Hit count: 255

Filed under:
|
|
|

In a script I want to be able to write an IP address to somewhere easily, so I thought using dig (or a similar command) with back-ticks.

However the simplest output I've been able to come up to wrt dig parameters is

> dig -t A +noall +answer www.google.com
www.google.com.     300 IN  A   173.194.66.106
www.google.com.     300 IN  A   173.194.66.104

Any way (extra arg, different tool instead of dig?) to get rid of the junk apart from the IP address?? (And please don't tell me to use sed.)

Thanks

© Server Fault or respective owner

Related posts about dns

Related posts about shell-scripting