hi!!!!!!!!!!! guys i have a csv file of following format!!!
ALPHA TANGO CHARLEE GRAVO
aa bb cc dd
aa dd ee ff
aa gg jj jj
aa ff tt kki want to change the format in followng manner
ALPHA TANGO CHARLEE GRAVO
aa bb cc dd
dd ee ff
gg jj jj
ff tt kk
i want to remove aa from next all fields and those fields should remain blank.any suggesstions to make these changes through batch script
thanks a lot!!!!!!!!!!!!
Hard to work out what you want. You say you have a csv file then show data without a single comma. Do you want to edit the .CSV file complete with comma separators or do you want to edit the file shown without commas?
my original file is as follows
NODE, Protocol,Process ID,Process Name,Local Address,Local Port
abc, TCP,0,SYSTEM,192.168.2.105,4457
abc, TCP,4,SYSTEM,192.168.2.105,139
abc, TCP,4,SYSTEM,0.0.0.0,445
abc, TCP,4,SYSTEM,192.168.159.1,139
i want to remove abc... from second field onwardsNODE, Protocol,Process ID,Process Name,Local Address,Local Port
abc, TCP,0,SYSTEM,192.168.2.105,4457
, TCP,4,SYSTEM,192.168.2.105,139
, TCP,4,SYSTEM,0.0.0.0,445
, TCP,4,SYSTEM,192.168.159.1,139thank u
Try this: @echo off>output.csv cls setlocal enabledelayedexpansion set counter=1 for /f "tokens=*" %%1 in (input.csv) do ( set inline=%%1 if !counter! gtr 2 (set inline=!inline:~3!) >>output.csv echo !inline! set /a counter+=1 )If that won't work because the variable in column 1 is not fixed at three bytes as you show, try the following:
@echo off>output.csv cls setlocal enabledelayedexpansion set counter=1 for /f "tokens=1* delims=," %%1 in (input.csv) do ( if !counter! gtr 2 ( >>output.csv echo ,%%2 ) else ( >>output.csv echo %%1,%%2 ) set /a counter+=1 )
thanks very much
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |