Skip to content

Instantly share code, notes, and snippets.

@chrosta
Created July 12, 2019 07:14
Show Gist options
  • Save chrosta/b52e63cab05c66b896f7f951adc33d1f to your computer and use it in GitHub Desktop.
Save chrosta/b52e63cab05c66b896f7f951adc33d1f to your computer and use it in GitHub Desktop.
for IP in $(cat IP.text | sort | uniq); do if [ $(nslookup $IP | egrep "^Name:" | wc -l) -eq "1" ]; then DN=$(nslookup $IP | egrep "^Name:" | sed 's/.*\ //g'); else DN="NA"; fi; echo "${IP//[$'\t\r\n']} ${DN//[$'\t\r\n']}"; done 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment