Skip to content

Instantly share code, notes, and snippets.

@aitseitz
Last active September 29, 2023 16:15
Show Gist options
  • Save aitseitz/334450cdf3165efed24cb4b48b837433 to your computer and use it in GitHub Desktop.
Save aitseitz/334450cdf3165efed24cb4b48b837433 to your computer and use it in GitHub Desktop.
Quickly get IP Adresses from a hostlist
#!/bin/bash
while read -r line || [[ -n $line ]];
do
# exlucde lines starting with a '#' character
if [[ ! $line =~ ^\# ]]; then
host "$line"
fi
done < resolve_hosts.txt | awk '{print($1 " --> "$4)}';
### List of Hostnames
# DEV Stage
acsedev01
acseam01
acseteam01
acseteam02
### Test Stage
acst01
acst02
asst01
asst02
aqst01
atst01
## Prod Stage
acsp01
acsp02
acsp03
acsp04
assp01
assp02
assp03
aqsp01
atsp01
atsp02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment