First time poster so my apologies if this has been covered in a previous topic that I was unable to locate. Basically I'm tasked with creating a script to perform a NSLookup on 50 domain names, format the results and pass them to the hosts file. I'll worry about checking and overwriting duplicate entries later.
Example:
Input: nslookup www.cbc.ca
Result: Name: a1849.gc.akamai.net Addresses: 184.50.238.64, 184.50.238.89 Aliases: www.cbc.ca, www.cbc.ca.edgesuite.net
Eventual Output: #184.50.238.64 www.cbc.ca a1849.gc.akamai.net
I figured this was possible with grep, awk and sed but have been messing about with switches and haven't gotten the right combination (mostly cause I'm not the most learned when it comes to regular expressions.) I'm partial to vbs, batch, cmd suggestions as well.
Thanks in advance for the time and effort! :)