Tuesday, February 2, 2021

resolve all the names & ips

.

canonical names
#!/bin/sh

for i in `cat ./names.txt`
do 
	nslookup $i | grep ^Name -A1| awk '{print $2}';
	echo
done  >> allthenames

ips
#!/bin/sh
for IP in `cat ./ips.txt`;
do
	printf "%-4s", $IP 
	nslookup $IP | grep -v nameserver | cut -f 2 | 
        grep name | cut -f 2 -d "=" | sed 's/ //';
	
done

No comments: