I'm using fabric to connect to remote linux servers to run commands. I then split it into a list but unable to extract specific data. How can I extract specific data?
Command to get the data:
>>> bpimage_cmd = ssh_connect.run(rf"sudo /usr/openv/netbackup/bin/admincmd/bpimagelist -L -backupid {last_backup_image} -media | egrep -w 'ID:'")
>>> bpimage_cmd.stdout
'Backup ID: hostname_1552094084\nJob ID: 4083686\n ID: L02266\n'
Split string to list:
>>> bpimage_list = [idx.strip() for idx in bpimage_cmd.stdout.split('\n') if idx.strip()]
>>> bpimage_list
['Backup ID: hostname_1552094084',
'Job ID: 4083686',
'ID: L02266']
I've tried converting the list to a dict, tried using ast and index to search the list in various forms with out success.
I would like to extract the "value", for example ID:, I would like to get L02266 and store it.