I would like to split the string to dictionary. String is taken by using
$ sudo btmgmt find |grep rssi |sort -n |uniq -w 33
and my result is
hci0 dev_found: 40:43:42:B3:71:11 type LE Random rssi -53 flags 0x0000
hci0 dev_found: 44:DA:5F:EA:C6:CF type LE Random rssi -78 flags 0x0000
The goal is creating dictionary where key is MAC address and value is rssi value
dict = {
"40:43:42:B3:71:11": "-53 ",
"44:DA:5F:EA:C6:CF": "-78",
}
I tried a lot of replace function to replace these Strings to empty Strings:
- hci0 dev_found:
- type
- LE
- Random
- rssi
But it must be cleaner and better way to do this dictionary and I do not see this solution.
Any ideas?