title: Spark read file with multiple record type
body: <p>All,</p>
  <p>I am trying to read the file with multiple record types in spark, but have no clue how to do it..
  Can someone point out, if there is a way to do it? or some existing packages?</p>
  <p>the example below - where we have a text file with 2 separate ( it could be more than 2 )
  record type :<br />
  00X - record_ind | First name| Last name<br />
  00Y - record_ind | Account #| STATE | country</p>
  <pre><code>input.txt
  ------------
  
      00X|Atun|Varma
      00Y|0002355|IL|USA
      00X|Diya|Reddy
      00Y|0002345|FL|USA
      
      sample output :
      output.txt
      ------------
      1|ATUL|VARMA|002355|USA
      2|Diya|Reddy|0002345|USA
  </code></pre>