I have a .csv file which looks like this:
...
;OUTPUT;DISCRETE;VOLTAGE1;;
;OUTPUT;DISCRETE;VOLTAGE2;;
...
Now I want to search this .csv file for the string "VOLTAGE1" and if found, write "#" to the beginning of the line where the search string was found.
So the .csv file should look like this after the batch script finishes:
...
#;OUTPUT;DISCRETE;VOLTAGE1;;
;OUTPUT;DISCRETE;VOLTAGE2;;
...
I already found the way how to search for a string in a file but I don't know how I can write "#" to the beginning of the line in the "do" part of the for loop. So how can I do this?
My code so far:
@echo off
setlocal
for /F "tokens=1* delims=;" %%a in ('findstr /I "VOLTAGE1" file.csv') do <write # to beginning of line>
endlocal