title: How to split a file into two files based on a pattern?
body: <p>In a file in <code>Linux</code> I have the following</p>
  
  <pre><code>123_test
  234_test
  abc_rest
  cde_rest
  and so on
  </code></pre>
  
  <p>Now I want to get two files in <code>Linux</code>. One which contains only records like below</p>
  
  <pre><code>123_test
  234_test
  </code></pre>
  
  <p>and 2nd file like below</p>
  
  <pre><code>abc_rest
  cde_rest
  </code></pre>
  
  <p>I want to split files based on what comes after <code>_</code> like <code>_test</code> or <code>_rest</code></p>
  
  <blockquote>
    <p>Edited:</p>
  </blockquote>
  
  <pre><code>123_test
  234_test
  abc_rest
  cde_rest
  456_test
  fgh_rest
  </code></pre>
  
  <p>How can I achieve that in Linux? </p>
  
  <p>Can we use split function for this?</p>