I try to get all occurences of a pattern from a file, but currently I fail if there is more than one occurence per line.
Sample line in file:
lorem ipsum foo="match1" lorem ipsum foo="match2" lorem ipsum
The output I want:
match1 match2
I tried getting this using sed:
sed -ne 's/^.*foo="\([^"]*\)".*$/\1/p'
With this expression I only get the first occurence, but I don't know how to make it better.
Thanks for your help.