Skip to content

Instantly share code, notes, and snippets.

@joshenders
Created April 13, 2011 03:50
Show Gist options
  • Save joshenders/916929 to your computer and use it in GitHub Desktop.
Save joshenders/916929 to your computer and use it in GitHub Desktop.
for vmhost in $(get-hosts oak-dev-vmhost); do
echo "$vmhost"
ssh root@$vmhost "virsh list --all" | \
sed -e '
/^\ I.*/d; # Id Name State
/^-.*/d; # ----------------------------------
/^$/d; # <blank lines>
' | \
tr -s ' ' | \
cut -d' ' -f3 | \
tr '\n' ' '
printf "\n"
done | grep -B1 $vmguest | head -n1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment