Reputation: 31
I need a bit of help parsing a list. I've got it till the "name" column but need to take it a bit further and drop off the "Name" tag and keep only the list (i.e. kvm670...kvm673). For example:
[root@la04 net]# virsh list | awk '{print $2}''
Name
kvm670
kvm671
kvm672
kvm673
How can I print only the kvm* fields?
Upvotes: 0
Views: 252
Reputation: 84443
Use a pattern to only print lines of interest. For example:
virsh list | awk '/kvm[[:digit:]]+/ {print $2}'
Upvotes: 2