Advertisement

10.13.2006 at 03:19PM PDT, ID: 22024135
[x]
Attachment Details

Batch File: parse csv file (for battery recall)

Asked by noodleNT in MS DOS

Tags: file, batch, csv, parse

I have csv file that I need to take the one line it creates and add it to a master csv file that is later imported into a DB.

What I have now works but for one problem. If the data has a space in it the field gets split into two columns.
example:
dog,cat,mouse,big dog,fish
ends up like
dog,cat,mouse,big,dog,fish

Where "big dog" should be one column.

Batch File:
ECHO Testing Battery
Start /wait battinfo.exe --unattended

ECHO Reading Results
for /f "skip=1 delims=, tokens=1-8" %%a in (battinfo.csv) do call :WriteCVS %%a %%b %%c %%d %%e %%f %%g %%h
GOTO Done

:WriteCVS
ECHO Append DB
ECHO %1,%2 %3,%4,%5,%6,%7,%8,%COMPUTERNAME%,%USERNAME%>>Recall.csv
GOTO EOF

:Done
ECHO Clean Up
ECHO.>battinfo.csv

:EOFStart Free Trial
[+][-]10.13.2006 at 03:22PM PDT, ID: 17728158

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.13.2006 at 03:27PM PDT, ID: 17728182

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.13.2006 at 03:36PM PDT, ID: 17728238

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.13.2006 at 03:44PM PDT, ID: 17728283

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.13.2006 at 03:52PM PDT, ID: 17728315

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.13.2006 at 03:53PM PDT, ID: 17728322

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS DOS
Tags: file, batch, csv, parse
Sign Up Now!
Solution Provided By: sirbounty
Participating Experts: 1
Solution Grade: A
 
 
[+][-]10.13.2006 at 04:22PM PDT, ID: 17728436

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32