Sample Header Ad - 728x90

how to extract just the IP address from a DNS query

24 votes
2 answers
37583 views
On Alpine Linux, I'd like to know how to extract just the IP address from a DNS / dig query. The query I'm running looks like this: lab-1:/var/# dig +answer smtp.mydomain.net +short smtp.ggs.mydomain.net 10.11.11.11 I'd like to be able to get just the IP address returned. I'm currently playing around with the bash pipe and the awk command. But so far, nothing I've tried is working. Thanks.
Asked by dot (755 rep)
Feb 26, 2018, 02:14 PM
Last activity: Jan 30, 2023, 12:55 PM