Greetings,
I have a list of 2 /24s worth of IP addresses in seperate text files. What I am interested in doing is finding a way to resolve the hosts of these IP addresses and filter out to display only the top level domain.
for example; 192.168.1.1 resolves to www.mywebsite.com
using shell scripting would it then be possible to filter out and append the result to a new file displaying 192.168.1.1 resolves to mywebsite.com
the reason for this is internally in the given /24s I am working with I have virtual machines such as web1-10 and mail-10 and i'd like to filter these matches to know only the domains I am running on my netblocks.
Thank you very much Team, I appreciate any assistance to help find a solution with this.
Best, Nick
once you have resolved the names, pipe your output to this :
awk -F'.' -v OFS='.' '{print $(NF-1),$NF}'
credit : http://groups.google.com/group/comp.lang.awk/browse_thread/thread/518fadbf02c4eb74?pli=1