I have this string in a bash variable
name : br-ext protocols : [protocol] name : br-ex protocols : [] name : br-local protocols : [other protocol] name : br-int protocols : []
and a variable $br containing on of the name : values (i.e br-ext)
Given $br, I want to access the protocol string that follows it (so $br br-ext should get 'protocol' and $br-ex should get '')
I've tried this, but it doesn't seem to access the value of the variable
echo $protocols | grep -oP "(?<=\"$br\")[^ ]*"
Any tips?