I would like to add a column to a CSV file so I can use the data with eSignal which is a stock charting program. The CSV file is in the following format Date,Time,Price,Volume. It does not have a header. For example here is a test.csv
100401,090037,0.9838,1,
100401,090058,0.9839,1,
100401,090100,0.9839,9,I would like the data changed so it reads T,Date,Time,Price,Volume. For example.
T,100401,090037,0.9838,1,
T,100401,090058,0.9839,1,
T,100401,090100,0.9839,9,Any suggestions would be greatly appreciated. I tried doing this in excel and word but the files are 300mb so it wouldn't work.
@echo off > newfile & setLocal enableDELAYedeXpansion for /f "tokens=* delims= " %%a in (my.csv) do (
>> newfile echo.T,%%a
)
=====================================
Helping others achieve escape felicityM2
Thank you for your speedy replies! Both methods worked flawlessly. The sed program took about 30secs to create the file, whereas the batch file took 30mins.
Thanks for the update. I was curious about how long it would take on a big file.
=====================================
Helping others achieve escape felicityM2
@M2, OP is not processing other columns, just adding something to the front. you can omit the tokens and delims. it should be a bit faster. (it will not be as fast as a dedicated tool for file parsing since the algorithm for parsing is compiled)
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |