Created
January 28, 2016 09:00
-
-
Save maximishchenko/6e6dc8b46b529f500339 to your computer and use it in GitHub Desktop.
nslookup(resolv)_multiple_hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Название файла со списком адресов | |
| inputfile="hosts.txt" | |
| # Имя файла для осуществления вывода | |
| outputfile="addresses.txt" | |
| # Очистка файла вывода при необходимости | |
| > ${outputfile} | |
| # Выполнить nslookup для каждой записи из файла со списком адресов | |
| for i in `cat ${inputfile}`; do nslookup $i >> ${outputfile}; done | |
| # Из файла вывода показать в stdout только строки, содержащие слова "Name" и "Address", т.е. DNS-server, FQDN, IP-address | |
| grep 'Name\|Address' ${outputfile} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment