I have the following text
abc <THIS> abc <THAT> abc <WHAT> abc
where abc is a placeholder for a well-defined expression. I would like to highlight 3 words in brackets and store them in 3 separate variables. Can this be done indiscriminately 3 times? Basically, I would like to capture and somehow βexportβ several groups.
It is clear that I can extract one of them as follows:
VARIABLE=`echo $TEXT | sed "s_abc <\(.*\)> abc <.*> abc <.*> abc_\1_g"`
But is it possible to get all 3 of them without running sed 3 times?
Other (portable) solutions without sed also welcome.
unix bash shell sed macos
Jawap
source share