How to split a CSV file into multiple files based on column value with header(not using AWK)
<p>I have a CSV with invoice data - e.g.:<br>
•Invoice #<br>
•PO Ref<br>
•Customer Code<br>
•Customer Name<br>
•Document Date<br>
•Product Code<br>
•Product Name  </p>

<p>This CSV will have varying amounts of lines per invoice, which relate to invoice produt lines, which may span multiple invoice numbers.</p>

<p>I need to be able to run a batch file to look at this CSV and split off into multiple CSVs based on the value in Col A - Invoice and each file generate with header in the file.</p>

<p>Eg:  </p>

<pre><code>Invoice,PORef,CustomerCode,CustomerName,DocumentDate,ProductCode,ProductName
111222,PO123,C100000,Test Store,1/1/15,AB1000,Test Soft Toy
111222,PO123,C100000,Test Store,1/1/15,AB1001,Test Soft Toy1
111222,PO123,C100000,Test Store,1/1/15,AB1002,Test Soft Toy2
222111,PO321,C111000,My Store,1/10/15,AB1000,Test Soft Toy
222111,PO321,C111000,My Store,1/10/15,AB1001,Test Soft Toy1
222111,PO321,C111000,My Store,1/10/15,AB1002,Test Soft Toy2
</code></pre>

<p>The .bat should run and split the CSV into 2 separate CSV's:</p>

<p>CSV1:</p>

<pre><code>Invoice,PORef,CustomerCode,CustomerName,DocumentDate,ProductCode,ProductName
111222,PO123,C100000,Test Store,1/1/15,AB1000,Test Soft Toy
111222,PO123,C100000,Test Store,1/1/15,AB1001,Test Soft Toy1
111222,PO123,C100000,Test Store,1/1/15,AB1002,Test Soft Toy2
</code></pre>

<p>CSV2:</p>

<pre><code>Invoice,PORef,CustomerCode,CustomerName,DocumentDate,ProductCode,ProductName
222111,PO321,C111000,My Store,1/10/15,AB1000,Test Soft Toy
222111,PO321,C111000,My Store,1/10/15,AB1001,Test Soft Toy1
222111,PO321,C111000,My Store,1/10/15,AB1002,Test Soft Toy2
</code></pre>

<p>Getting software installed on my server is going to a hassle - as such, if there is anyway that this can be done without having to install software this would make me very happy.</p>

<p>I appreciate that there have been similar questions asked previously - however, I haven't been able to find out if there is another script I can run without installing Awk.</p>

<p>Regards Amol Murkute</p>