title: How to extract characters between the delimiters using sed?
body: <p>I have just started learning sed. I want to extract and print the characters between the > and &lt; delimiters. Here the text in my data file:  </p>
  
  <pre><code>&lt;span id="ctl00_ContentPlaceHolder1_lblRollNo"&gt;12029&lt;/span&gt;
  
     &lt;br /&gt;&lt;b&gt;Engineering &amp; IT/Computer Science&lt;/b&gt;&lt;br /&gt;
  
          &lt;div id="ctl00_ContentPlaceHolder1_divEngITMerit"&gt;
  
                          &lt;span id="ctl00_ContentPlaceHolder1_lblEngITSelListNo"&gt;3rd Provisional Selection List&lt;/span&gt;
  
                  &lt;tr&gt;&lt;td style='width: 200px' class='TblTRData'&gt;IT/Computer Science/Software&lt;/td&gt;&lt;td style='width: 150px'class='TblTRData'&gt;7 (out of 471)&lt;/td&gt;&lt;td style='width: 325px'class='TblTRData'&gt;Selected in MS COMPUTER SCIENCE&lt;/td&gt;&lt;/tr&gt;
  
                                  Name:
  
                                  &lt;span id="ctl00_ContentPlaceHolder1_lblName"&gt;SIDRA SHAHID&lt;/span&gt;
  
                                  Father Name:
  
                                  &lt;span id="ctl00_ContentPlaceHolder1_lblFatherName"&gt;SHAHID RAFEEQ AHMAD&lt;/span&gt;
  </code></pre>
  
  <p>I have written the command:</p>
  
  <pre><code>sed -n -e '/^[^&gt;]*&gt;\([^&lt;]*\)&lt;.*/s//\1/p' myfile.txt
  </code></pre>
  
  <p>The problem is that it is returning the text between some of the > &lt;. For example, it prints <strong>12029</strong>, but not Selected in <strong>Selected in MS COMPUTER SCIENCE</strong>. What am I doing wrong?</p>