JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
IanC
Posts: 4
Joined: 06 Oct 2021 05:49

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#496 Post by IanC » 08 Oct 2021 05:34

IanC wrote:
07 Oct 2021 15:01
aGerman wrote:
06 Oct 2021 10:30
If you want to use \r and \n you have to pass option /XSEQ.
That should work:

Code: Select all

Call jrepl "\<extensions\>\r\n.*?\r\n\<\/extensions\>\r\n" "" /XSEQ /M /F "MMT.gpx" /O -
Steffen
Many thanks, that did it!
And if I wanted to loop through every GPX file in a directory?? I've attempted to splice together with the looping as shown here without success:
https://stackoverflow.com/questions/180 ... tch-script

Code: Select all

for /f "usebackq delims=|" %%f in (`dir /b "*.gpx"`) do call jrepl "\<extensions\>\r\n.*?\r\n\<\/extensions\>\r\n" "" /XSEQ /M /F %%f /O -
For the sake of simplicity, JREPL and my batch file are in the same directory as the files I'm attempting to process.

aGerman
Expert
Posts: 4297
Joined: 22 Jan 2010 18:01
Location: Germany

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#497 Post by aGerman » 08 Oct 2021 09:18

I'd guess that it should already work out of the box. USEBACKQ is not necessary and you also don't need the pipe as delimiter. Thus, a simple FOR will do the job. However, it may fail if the file name contains spaces or special characters like ampersands. Better quote file names represented by %%f.
Not tested:

Code: Select all

for %%f in ("*.gpx") do call jrepl "\<extensions\>\r\n.*?\r\n\<\/extensions\>\r\n" "" /XSEQ /M /F "%%~f" /O -
Steffen


Post Reply