title: get specific lines with grep
body: <p>I would like to parse a text like that:</p>
  <pre><code># cmd: Text_finder --outdir 1
  # No Text found
  # cmd: Text_finder --outdir 2
  ID_Text ID element  pos_beg pos_end model   type    default distance
  Text_01 tt  001 38  108 1   6.3e-05     No
  Text_01 tt  002 454 517 1   1.9e-05     No
  Text_01 tt_c7   003 1276    1362    1   2.2e-08     No
  # cmd: Text_finder --outdir 3
  # No Text found
  # cmd: Text_finder --outdir 4
  # No Text found
  # cmd: Text_finder --outdir 5
  ID_Text ID element  pos_beg pos_end model   type    default distance
  Text_01 tt  001 38  108 1   6.3e-05     No
  </code></pre>
  <p>in order to retrieve lines starting with &quot;Text_01&quot; (results), &quot;ID_Text&quot; (headline) but also line before &quot;ID_Text&quot; (starting with &quot;# cmd:&quot; but also common to the line with no result I want to get ride off).</p>
  <p>I have tried to combine and execute these lines:</p>
  <pre><code>#get lines with &quot;ID_text&quot; and &quot;text_01&quot;
  grep -P &quot;ID_text|text_01&quot; result.txt &gt; positive-results.txt;
  
  #get line before line with &quot;ID_text&quot; 
  grep -B1 &quot;ID_text&quot; result.txt &gt; positive-results.txt;
  </code></pre>
  <p>but I cannot get a file like that:</p>
  <pre><code># cmd: Text_finder --outdir 2
  ID_Text ID element  pos_beg pos_end model   type    default distance
  Text_01 tt  001 38  108 1   6.3e-05     No
  Text_01 tt  002 454 517 1   1.9e-05     No
  Text_01 tt_c7   003 1276    1362    1   2.2e-08     No
  # cmd: Text_finder --outdir 5
  ID_Text ID element  pos_beg pos_end model   type    default distance
  Text_01 tt  001 38  108 1   6.3e-05     No
  </code></pre>
  <p>Do you have a smart way to do that?</p>
  <p>Thanks a lot</p>