Computing.Net > Forums > Programming > Variables from CSV

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Variables from CSV

Reply to Message Icon

Name: mkswanson
Date: July 28, 2009 at 12:05:45 Pacific
OS: Windows XP
CPU/Ram: 1.828 GHz / 2037 MB
Subcategory: Batch
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: July 28, 2009 at 12:32:33 Pacific
Reply:

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


0

Response Number 2
Name: mkswanson
Date: July 28, 2009 at 12:42:21 Pacific
Reply:

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%


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Variables from CSV

Access Javascript Variables from IE www.computing.net/answers/programming/access-javascript-variables-from-ie/8500.html

getting a variable from batch file www.computing.net/answers/programming/getting-a-variable-from-batch-file/16771.html

Variable from a list file www.computing.net/answers/programming/variable-from-a-list-file/17057.html