I am using vboxmanage list -l vms and I want to extract the UUID for a specific machine by giving the Name and Groups values.
Name: vm2
Groups: /C05Lab1
Guest OS: Oracle (64-bit)
UUID: 54c233e8-3d5b-46bb-9a21-a8946ffa7d76
Config file: C:\Users\Bianca\VirtualBox VMs\C05Lab1\vm2\vm2.vbox
Snapshot folder: C:\Users\Bianca\VirtualBox VMs\C05Lab1\vm2\Snapshots
Log folder: C:\Users\Bianca\VirtualBox VMs\C05Lab1\vm2\Logs
Hardware UUID: 54c233e8-3d5b-46bb-9a21-a8946ffa7d76
I got to:
vboxmanage list -l vms | awk '$1=="UUID:"{uid=$2} /Name: *vm2/{print uid}'
It at least lists an uuid, but not the right one(it prints the uuid of the machine before it) and I have no idea how to check for the Groups value because it starts with a /