title: Print text between ( )  sed
body: <p>This is an extension of my previous <a href="https://stackoverflow.com/questions/5972622/print-text-between-delimiters-using-sed/">question</a>.  In that question, I needed to retrieve the text between parentheses where all the text was on a single line.  Now I have this case:</p>
  
  <pre><code>(aop)
  (abc
  d)
  </code></pre>
  
  <p>This time, the open parenthesis can be on one line and the close parenthesis on another line, so:</p>
  
  <pre><code>(abc
  d)
  </code></pre>
  
  <p>also counts as text between the delimiters '<code>( )</code>' and I need to print it as</p>
  
  <pre><code>abc
  d
  </code></pre>
  
  <p>EDIT:
  In response to possible confusions of my question, let me clarify a little. Basically, I need to print text between delimiters which could span multiple lines.</p>
  
  <p>for example I have this text in my file:</p>
  
  <pre><code>randomtext(1234
  567) randomtext
  randomtext(abc)randomtext
  </code></pre>
  
  <p>Now I want Sed to pick out text between the delimiter "(" and ")". So the output would be:</p>
  
  <pre><code>1234
  567
  abc
  </code></pre>
  
  <p>Notice that the left and right brackets are not on the same line but they still count as a delimiter for 1234 567, so I need to print that part of the text. (note, I only want the text between the first pair of delimiters).</p>
  
  <p>Any help would be appreciated.</p>