Last active
January 8, 2018 04:06
-
-
Save fent/7807602 to your computer and use it in GitHub Desktop.
Returns a list of servers matching a pattern.
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 | |
h=$1 | |
if [ -z $1 ] | |
then | |
echo "Usage: `basename $0` <host pattern>" | |
exit 1 | |
fi | |
ec2-host | grep $h | awk '{split($0, a, "\t"); print a[2]}' | awk '{x = (!x) ? $0 : x "\n" $0;} END {print x;}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment