I have a text file with a list ip addresses and other information.
I am using an awk script to process this list and output various computations. I want to call dig -x
from inside the awk script and use the returned value.
I have tried
hostname = system("dig +short -x" ip_address);
but what occurs is –
-
the call to dig prints a line to the shell
-
hostname remains null
Best Answer
Figured it out, but please feel free to add better answers
Then I can use the hostname anywhere in the script.