title: How to remove a set of chars from a string if it exists
body: <p>I have a file having below strings formats:</p>
  
  <pre><code>abc
  xyz
  statexyz_pqr_mho
  dce
  statelop_pqz_mho
  </code></pre>
  
  <p>I am in need to remove from all lines till <strong>'_'</strong> if <strong>state</strong> word exists in the beginning of the string</p>
  
  <p>So the final list should be  -</p>
  
  <pre><code>abc
  xyz
  pqr_mho
  dce
  pqz_mho
  </code></pre>