Skip to content

Instantly share code, notes, and snippets.

@richardcurteis
Created August 23, 2021 08:54
Show Gist options
  • Select an option

  • Save richardcurteis/69246d054f4a573c67e3b5ef867ab0cb to your computer and use it in GitHub Desktop.

Select an option

Save richardcurteis/69246d054f4a573c67e3b5ef867ab0cb to your computer and use it in GitHub Desktop.
Handy bash snippets
# 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