computing
  • 4

Inserting a Column Into a CSV File

  • 4

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.

Share

1 Answer

  1. @echo off > newfile & setLocal enableDELAYedeXpansion

    for /f “tokens=* delims= ” %%a in (my.csv) do (
    >> newfile echo.T,%%a
    )

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

    M2

    • 0