I need to replace a single line in a file. Generally, this code works fine:
(The actual specifics on what this block is doing is not necessary for this question).
for /F "tokens=1* delims=:" %%a in ('findstr /N "^" %DATA%') do (
if %%a equ %TargetLine% (
echo !insert!>>%filepath%cc.tmp
) else (
if [%%b]==[] (echo.>>%filepath%cc.tmp) else (echo %%b>>%filepath%cc.tmp)
)
)
Unfortunately, each line is assigned to %%a, which like any other variable can only store a maximum length of 8,192 characters (thanks dbenham for that tidbid, comes in use now).
So what options do I have when the line is greater than 8,192 characters (23,708 in this case)?
Before you ask: No it cannot be separated to a new line, it is an 10k JSON array encoded in Base64 which is then written into a ByteArray.
I assume that the way to go is using regular expressions, is this the correct assumption, or is there another workaround?
Thanks.