Is it possible to tell "JREPL.bat" to only replace the second match of "[AddReg]" in a text file? I have tried to find a solution for days now, but failed.
The "JREPL.bat" command /INC "3:7" does not help because the line numbers will change too much depending on the text file.
CALL ".\JREPL.bat" "\[AddReg\]" "[AddReg]\r\nNewLine." /XSEQ /M /F "test.txt" /O "test1.txt"
[AddReg]
1TEST.
2TEST.
3TEST.
[AddReg]
1TEST.
2TEST.
3TEST.
[AddReg]
1TEST.
2TEST.
3TEST.
As far as I can tell, there is no native way to accomplish this with JREPL.bat. However, if you're willing to use a custom Batch script to accomplish this, something along the lines of the following will do:
The script will ignore the first match, replace the second, then exit the loop.