Variables from CSV

July 28, 2009 at 12:05:45
Specs: Windows XP, 1.828 GHz / 2037 MB
I have a file (file.txt) that contains multiple lines
of data. Each line has 10 columns, delimited
by commas. I need to write column 1, 5 and
10 to a file using the echo command.

I have:

for /f "tokens=1,2,3,4,5,6,7,8,9,10 delims=,"
%%a in (file.txt) do set store=%%a&set
description=%%e&set plu=%%j&echo %store%
%plu% %description% >> %report_file%

This is working, except that it is only
processing (or at least writing) the last line in
file.txt to my report. I'm sure I'm missing
something simple, but I'm not getting it.

Any suggestions would be greatly appreciated.

See More: Variables from CSV

Report •

July 28, 2009 at 12:32:33
for /F "tokens=1,5,10 delims=," %%i (file.txt) do echo.%%i %%j %%k>> %report_file%

Report •

July 28, 2009 at 12:42:21
Thank you! I got it to work with one minor change:

for /F "tokens=1,5,10 delims=," %%i IN (file.txt) do echo.%%i
%%j %%k>> %report_file%

Report •

Related Solutions

Ask Question