Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have a follow CSV file:
ActionCode,OpCode,PassFail,Protocol,URL Execute,OpenBrowserWMI,Pass,http,www.google.com ActionCode,OpCode,PassFail Execute,CloseBrowserWMI,Pass ActionCode,OpCode,PassFail,Protocol,URL Execute,OpenBrowserWMI,Pass,http,www.google.com ActionCode,OpCode,PassFail Execute,CloseBrowserWMI,Pass ActionCode,OpCode,PassFail,Protocol,URL Execute,OpenBrowserWMI,Pass,http,www.google.com ActionCode,OpCode,PassFail Execute,CloseBrowserWMI,Passand I need insert a new column bettween OpCode,PassFail in whole file not in the first line in around 1000 files.
for example:
ActionCode,OpCode,NEWCOLUMN,PassFail,Protocol,URL Execute,OpenBrowserWMI,NEWCOLUMN,Pass,http,www.google.com ActionCode,OpCode,NEWCOLUMN,PassFail Execute,CloseBrowserWMI,NEWCOLUMN,Pass ActionCode,OpCode,NEWCOLUMN,PassFail,Protocol,URL Execute,OpenBrowserWMI,NEWCOLUMN,Pass,http,www.google.com ActionCode,OpCode,NEWCOLUMN,PassFail Execute,CloseBrowserWMI,NEWCOLUMN,Pass ActionCode,OpCode,NEWCOLUMN,PassFail,Protocol,URL Execute,OpenBrowserWMI,NEWCOLUMN,Pass,http,www.google.com ActionCode,OpCode,NEWCOLUMN,PassFail Execute,CloseBrowserWMI,NEWCOLUMN,PassLook the lines, it has diferent numbers of parameters but the first three always are the same.
Anybody knows how to I resolve this question.
Thanks a lot BOSCO

@echo off & setlocal EnableDelayedExpansion for %%j in (*.csv) do ( set /P header=< %%j echo.!header!> %%~nj.new for /F "skip=1 tokens=1,2,* delims=," %%a (%%j) do ( echo.%%a,%%b,,%%c>> %%~nj.new ) ) :: End_Of_Batch

![]() |
xcopy vs copy
|
Batch file renaming
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |