Last active
September 29, 2023 16:15
-
-
Save aitseitz/334450cdf3165efed24cb4b48b837433 to your computer and use it in GitHub Desktop.
Quickly get IP Adresses from a hostlist
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 | |
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)}'; |
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
### 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