So my bash scripting is not the best, but the following script takes IP addresses from a text file and feeds the output to a shell and shows only the dns host names that resolve.
#!/bin/bash
while read line
do
dig @1.2.3.4 -x "$line" +short
done
and the output would look like:
one.foo.local
two.foo.local
three.foo.local
How can I also print the ip address for the address that resolve to a dns name on the same line so it would appear like:
one.foo.local 2.3.4.5
two.foo.local 6.7.8.9
three.foo.local 7.5.3.1
Thanks