0

I have 4 rows and 7 columns each in CSV file. I want to read each and every row in a source CSV file and store in to 4 different CSV file. But i am getting only one CSV file with 4th row input. Please help me if anyone has any idea

Below is my code

@echo off
set I=1
echo %I%
pause
for /F "tokens=1-7 delims=," %%a in (1234.csv) do (           
set a1=%%a
set a2=%%b
set a3=%%c
set a4=%%d
set a5=%%e
set a6=%%f
set a7=%%g
echo %%a, %%b, %%c, %%d, %%e, %%f, %%g > %I%.csv
set /a I=%I%+1
echo %I%
pause

)

Mey
  • 21
  • 1
  • 3
  • Only one CSV file is getting created and only last row of the source file is getting added – Mey Mar 20 '17 at 14:27
  • What is this? Bash? You may want to add the relevant [tag](http://stackoverflow.com/help/tagging) to draw the attention of experts on the subject. – Bernhard Barker Mar 20 '17 at 14:55
  • you need [delayed expansion](http://stackoverflow.com/a/30284028/2152082) to properly process `%I` (btw: `set I+=1` works good to add `1`) – Stephan Mar 21 '17 at 13:30

0 Answers0