シェルスクリプト

 #!/bin/sh
 
 GUESTNAME=`virsh list |grep -v "Id"| sed -e 's/----------------------------------------------------//'|cut -c5-|sed -e 's/実行中//'`
 
 echo " "
 echo " HostName         VNC Display Number"
 echo "-----------------------------------------"
 
 for i in $GUESTNAME
 do
         VNC=`virsh vncdisplay $i`
         echo -e "$i\\t\\t$VNC"
 done
 
 echo " "

結果表示 [#s756416d]

  HostName         VNC Display Number
 -----------------------------------------
 VM01           :0
 VM02           :1
 VM03           :2
 VM04           :3