This is my very short script to display some information about storage volumes:
get_ip="$(ssh $1@$2 volume show"
echo "$get_ip"
when I run my bash script this is what is spit out to the terminal:
Vserver Volume Aggregate State Type Size Available Used%
--------- ------------ ------------ ---------- ---- ---------- ---------- -----
vs_cfm06 Available aggr_backup_1 online RW 100GB 66.35GB 33%
vs_cfm06 Discovery aggr_backup_1 online RW 100GB 66.35GB 33%
vs_cfm06 Software aggr_backup_1 online RW 100GB 65.08GB 34%
vs_cfm06 Template aggr_backup_1 online RW 100GB 66.35GB 33%
vs_cfm06 rootvol aggr_backup_1 online RW 1GB 972.5MB 5%
vs_cfm06 vol aggr_backup_1 online RW 1GB 972.6MB 5%
6 entries were displayed.
all I really want is the names of the Volumes:
Volume
---------
Available
Discovery
Software
Template
rootvol
vol
What change do I need to make to my command to get only this information? Many thanks!
echo "$get_ip" | grep -v "entries" | awk '{print $2}'
or with cut:
echo "$get_ip" | tr -s " " | grep -v "entries" | cut -d " " -f 2