I have a csv file with the below contents.
userid,userRole,ContentType
1,text1,value1,
2,text2,value2,
I want to write a batch file to add few column headers at the beginning of the csv file. I had this piece of code working to add only one additional column. Is it possible to add multiple columns based on column position?
e.g. I want to add a new column in 2nd and 5th position.
@echo off > newfile.csv & setLocal enableDELAYedeXpansion
for /f "tokens=* delims= " %%a in (input.csv) do (
>> newfile.csv echo.FirstName,%%a
)
Any help would be appriciated.
for /fwith possible empty columns,,will fail becausefor /fignores leading delimiters and treats successive delimiters as only one.