I'm writting a script in Windows, a .BAT file, to replace:
Note that there is an ENTER, I mean the string is in two lines. And looks more complicated now: after the 2 double quotes there are 2 blank spaces and then the "ENTER"
""
"2014
So, something like: (double quote)(double quote)(space)(space)(newline)(double quote)2014
I'm having problems with this. This is how the script looks like:
@echo off
setlocal enabledelayedexpansion
set INTEXTFILE=FILE_IN_CSV.csv
set OUTTEXTFILE=222.csv
set SEARCHTEXT=^"^"^"2014
set REPLACETEXT=^"^"^"4
set OUTPUTLINE=
for /f "tokens=1,* delims=¶" %%A in ( '"type %INTEXTFILE%"') do (
SET string=%%A
SET modified=!string:%SEARCHTEXT%=%REPLACETEXT%!
echo !modified! >> %OUTTEXTFILE%
)
del %INTEXTFILE%
rename %OUTTEXTFILE% %INTEXTFILE%
Any ideas?
Thanks!
EDIT: adding source text example. See that there are 3 (not 2!) black spaces at the end of each line.
"2014091810000076";"Question about folder sizes";"2014-09-18 12:10:20";"2014-09-25 17:33:15";"Resolt Sistemes";"jbgsfnam";"Sistemes::Altres";"STFD";"peticions";""
"2014091910000109";"Error opening word files with office 2013";"2014-09-19 09:50:07";"2014-09-25 14:27:59";"Resolt TRO";"yerttom";"Qualitat::Altres";"STFD";"peticions";""
I just need to delete the 20 at the beginning of each line, but not the others 20 in the middle of lines.