title: How can these two `sed` commands be compressed into one?
body: <p>More a curiosity, but is there a way to compress these two sed commands into one? </p>
  
  <pre><code>sed -r '/sometext/!d' file.txt | sed -r '5,10!d'
  </code></pre>
  
  <p>The above gives me the 5th through 10th instances (6 in total) of a lines that contain "sometext".</p>
  
  <p>The concatenation :</p>
  
  <pre><code>sed -r '/sometext/!d;5,10!d' file.txt
  </code></pre>
  
  <p>gives me only the lines that have "sometext" appearing in the 5th through 10th lines of original file.</p>