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