Script required to find duplicate hostname resolve with DNS
In our build environment we want find Duplicate hostname entry against all. We need a script which will run following logic
1.get IPs from file
2. run nslookup <ipaddress1> - it will give hostname1 (it will give only one hostname)
then again I need to type same Ip again to get second hostname.(dublicate hostname)
nslookup <ipaddress1> it will give hostname2 ( In this example hostname1 and hostname2 pointing to same IP)
So what i need is nslookup <ipaddress> part need to run two times one after another continuously and outputs need to be compared. If output hostnames differs it need to be pasted as duplicate hostname entry for that IP. if it hostname didn't vary the output don't need to be reported.