I'm trying to get the name of a DNS server 4.2.2.1.
Using host 4.2.2.1 I get this output:
1.2.2.4.in-addr.arpa domain name pointer a.resolvers.level3.net
in my script, I do this as:
name="$($host $server)"
How can I use sed/awk on $name to only get the a.resolvers.level3.net, keeping in mind that I'll use this on completely different servers so I can't just grep a.resolvers out of the variable?
name="$($host $server)"is a typoand you're actually usingname="$(host $server)", right? Also, I removed a trailing.from yourhostoutput since that looked like a typo. Please confirm that it was indeed not supposed to be there.hostoutputs them.