title: How to extract text between two words in unix?
body: <p>I <br />
  am <br />
  using <br />
  basic <br />
  sed <br />
  expression :-</p>
  
  <pre><code>sed -n "am/,/sed/p" 
  </code></pre>
  
  <p>to get the text between "am" and "sed" 
  which will output "am \n using \n basic \n sed".
  But my real problem is if the string would be :-</p>
  
  <p>I <br />
  am <br />
  using <br />
  basic <br />
  grep <br />
  expression. </p>
  
  <p>I applied the above sed in this sentence
  then it gave "am \n using \n basic \n grep \n expression"
  which it should not give it. How to discard the 
  output if there would be no matching?</p>
  
  <p>Any suggestions?</p>