Batch CSV - Extract Data

August 9, 2010 at 05:22:53
Specs: Windows XP
I have a file called test.csv that contains several lines of data.

I want to create a bat file that extracts all the data in line 1 into a new text file.

New Text Test.txt


See More: Batch CSV - Extract Data

Report •


#1
August 9, 2010 at 06:22:48
@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (test.csv) do (
> newfile echo.%%a
goto :eof
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
August 9, 2010 at 06:31:17
Thanks a for a quick response

If I use the sane CSV File test.csv but this time I want to delete the top line of the file.

How would you do this with a BAT file?


Report •

#3
August 9, 2010 at 06:37:14
@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "skip=1 tokens=* delims= " %%a in (test.csv) do (
>> newfile echo.%%a
)


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
August 9, 2010 at 06:49:11
Thanks - I want to overwrite the test.csv file once it has deleted the top line

Report •


Ask Question