Print ALL matching words in a string

view full story

http://www.unix.com – Hi. Code: str=" {aaID=z_701; time=2012-10-08 00:00:00.000}; {aaID=S_300; time=2012-10-08 00:00:00.000}]}; ansokningsunderlag={anmaln......} {aaID=x_500; time=2012-10-08 00:00:00.000}]}; ansokningsunderlag={anmaln......}" I want to print: Code: z_701 S_300 x_500 if I use : Code: echo $str | sed -n 's/.*aaID=\(.*\)time.*/\1/p' the output is just the last hit. Code: x_500 How do i do to get all matches? /Fred Moderator's Comments: Please use code tags nex (HowTos)