spllit the csv file into multiplecsv files using spark
<p>I am new to spark.I have the csv file like below. Based on the name(james,hiran,stalin) I want to store the data in a seperate files.</p>

<pre><code>100|james|76|23|24|34
101|hiran|84|32|232|13
102|james|78|13|42|32
103|stalin|78|42|13|23
104|hiran|23|21|22|13
105|hiran|23|32|32|32
</code></pre>

<p>I want process this file based on name(second field).
I want the output like below. james out i want to store in a seperate file. james_output.</p>

<pre><code>100|james|76|23|24|34
102|james|78|13|42|32
</code></pre>

<p>Hiran output should be stored in a seperate file.hiran_output</p>

<pre><code>101|hiran|84|32|232|13
104|hiran|23|21|22|13
</code></pre>

<p>stalin output should be  stored in a seperate file.</p>

<pre><code>103|stalin|78|42|13|23
</code></pre>