script to run dig using a file input
Posted on 2011-02-20
I am using dig -f ( -f means a file name) which I have a list if zones. like
It runs fine but I only want to know if a certain NS record exists. For example wan.rich.com if that criteria matches create a file with the domain name and NS record.
If wan.rich.com is not part of the NS record then output a file with the zone name and the NS record
Zone name: NS Record
All zones that have wan.rich.com are:
is there a grep or sed command to go through the file to show me?
I tried grep -i wan.rich.com output.txt
I get a response 3 times for each zone meaning duplicates cause there are wan.rich.com, 1.wan.rich.com, 2.wan.rich.com and 3.wan.rich.com for each zone name
Each domain has these 3 entries, I just want to know per domain. I dont want to end up with a report that has 3 same domains for each NS record.