Created
August 23, 2021 08:54
-
-
Save richardcurteis/69246d054f4a573c67e3b5ef867ab0cb to your computer and use it in GitHub Desktop.
Handy bash snippets
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
| # nslookup and IP address extraction for a file of FQDN hosts | |
| for host in cat $( cat fqdns.txt ) ; do nslookup $host | egrep "^(:?Address:).*([0-9]{1,3}\.){3}[0-9]{1,3}$" | awk '{ print $2 }' >> hosts_from_fqdn.txt ; cat hosts_from_fqdn.txt | sort -u > t ; cp t hosts_from_fqdn.txt ; rm t ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment