I have some Web URLs I am trying to do a nslookup
against. All it does is check against the URL and print the ones not equals to some certain IP Address into a file. I am able to do it for one IP Address but i tried adding one more, and I am unable to get it to work.
SUB='.com'
for address in `cat linux.hosts`; do
if [[ "$address" == *"$SUB"* ]]; then
echo "Got [$address]"
nslookup $address \
| awk '!/155.55.66.55/ || !/155.55.66.54/' >> com.txt
fi
done
The linux.hosts
file contains info like this
A B B { D E google.com }
A B B { D E twitter.com }
A B B { D E microsoft.com }
A B B { D E facebook.com }
I only want to get the string that has ".com" in it and do a nslookup that doesn't contain a certain IP Address.
The $nslookup address returns
Got [google.com]
Server: BBBB:BBBB:BBBB:BBBB::1
Address: BBBB:BBBB:BBBB:BBBB::1#53
Non-authoritative answer:
Name: google.com
Address: 155.55.66.55
Name: google.com
Address: 155.55.66.54
The | awk '!/155.55.66.55/ || ' >> com.txt
works for some of the address that only contains 155.55.66.55 but if contains 155.55.66.54 it does not work, hence i am trying to add another check.
I only want to print the domains with address that doesn't contain 155.55.66.54 and 155.55.66.55.
The $nslookup address should only return
Got [twitter.com]
Server: BBBB:BBBB:BBBB:BBBB::1
Address: BBBB:BBBB:BBBB:BBBB::1#53
Non-authoritative answer:
Name: google.com
Address: 198.168.101.1
Name: google.com
Address: 198.168.101.2