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
dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#211 Post by dbenham » 23 Jul 2016 07:26

I see no reason to user JREPL (or any other regex tool) for this problem.

Once you know the length of the folder path, then a simple substring is all you need - a standard feature of variable expansion.

It is easy to avoid problems with exclamation points and delayed expansion within a FOR loop if you toggle the delayed expansion on and off.

On my machine, the ICACLS command outputs a summation line at the end that must be ignored - Something like "Successfully processed 1 files; Failed processing 0 files" I could use FINDSTR to filter out lines that begin with "Successfully", but then I could not process a folder that begins with that value. So I use a trick to process the previous line within a loop, thus the last line is never processed.

I also redirect stderr to stdout so that you get nice output if you pass in an invalid path.

I avoid having to add one to the string length by appending an extra character to the variable definition.

Code: Select all

@echo off
setlocal disableDelayedExpansion

for %%F in (
  "c:\Program Files (x86)"
  "c:\Program Files\Common Files"
  .
  SomeInvalidPath
) do (
  set "folder=x%%~F"
  call :strLen len folder
  echo CurrentFolder: __________ %%~F
  set "ln="
  for /f "eol=: delims=" %%A in ('icacls "%%~F" 2^>^&1') do (
    if defined ln (
      setlocal enableDelayedExpansion
      for %%N in (!len!) do echo !ln:~%%N!
      endlocal
    )
    set "ln=%%A"
  )
  echo(
)
exit /b

:strlen <resultVar> <stringVar>
(
    setlocal EnableDelayedExpansion
    set "s=!%~2!#"
    set "len=0"
    for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
        if "!s:~%%P,1!" NEQ "" (
            set /a "len+=%%P"
            set "s=!s:~%%P!"
        )
    )
)
(
    endlocal
    set "%~1=%len%"
    exit /b
)


It is easy to solve the problem with JREPL with a minimal amount of code, but it really is actually significantly slower due to start up times for each JREPL instantiation. And it feels like I am going out of my way to use JREPL when the actual problem does not really call for regular expressions.

Code: Select all

@echo off
setlocal disableDelayedExpansion

for %%F in (
  "c:\Program Files (x86)"
  "c:\Program Files\Common Files"
  .
  someInvalidPath
) do (
  echo CurrentFolder: __________ %%~F
  for /f %%N in ('echo %%~F^|jrepl "^.*" "$0.length+1" /j') do (
    icacls "%%~F" 2>&1 | jrepl ".{%%N}(.*)" "$1" /jmatch /exc -1
  )
  echo(
)


Dave Benham

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#212 Post by mirrormirror » 23 Jul 2016 15:53

Thanks Dave, your solution works even with a crazy folder named "1% . a! b! c! ^ 'name1 = name +2".

I like the following and will remember it for next time:

Code: Select all

I avoid having to add one to the string length by appending an extra character to the variable definition.

I do have a few questions:

1: In jrepl, are there any rules for quoting the regex matched groups? For example the $1 is quoted on one example but not in the other:
jrepl ".{%myLen%}(.*)$" $1 /jmatch
jrepl ".{%%N}(.*)" "$1" /jmatch

2: I did not see the ".length" property documented in jrepl. Can you give a bit of info. on this and if there are any other properties like this that can be used? From your example:
jrepl "^.*" "$0.length+1"

3: The jrepl solution fails to properly trim the output on the crazy folder name - you can below the sample script and output - I think the <CARET> causes the problem:

Code: Select all

@echo off &setlocal disableDelayedExpansion
SET "directory=1% . a! b! c! ^ 'name1 = name +2"
IF NOT EXIST "%directory%" MD "%directory%"

for %%F in (
  "c:\Program Files (x86)"
  "c:\Program Files\Common Files"
  "%directory%"
  .
  someInvalidPath
) do (
  echo CurrentFolder: __________ %%~F
  for /f %%N in ('echo %%~F^|jrepl "^.*" "$0.length+1" /j') do (
    icacls "%%~F" 2>&1 | jrepl ".{%%N}(.*)" "$1" /jmatch /exc -1
  )
  echo(
)
Output:

Code: Select all

CurrentFolder: __________ c:\Program Files\Common Files
NT SERVICE\TrustedInstaller:(F)
NT SERVICE\TrustedInstaller:(CI)(IO)(F)
NT AUTHORITY\SYSTEM:(M)
NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
BUILTIN\Administrators:(M)
BUILTIN\Administrators:(OI)(CI)(IO)(F)
BUILTIN\Users:(RX)
BUILTIN\Users:(OI)(CI)(IO)(GR,GE)
CREATOR OWNER:(OI)(CI)(IO)(F)

CurrentFolder: __________ 1 . a! b! c! ^ 'name1 = name +2
 BUILTIN\Administrators:(I)(F)
 BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
 NT AUTHORITY\SYSTEM:(I)(F)
 NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
 NT AUTHORITY\Authenticated Users:(I)(M)
 NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
 BUILTIN\Users:(I)(RX)
 BUILTIN\Users:(I)(OI)(CI)(IO)(GR,GE)


It is easy to solve the problem with JREPL with a minimal amount of code, but it really is actually significantly slower due to start up times for each JREPL instantiation.
I'm not super concerned with the added delay of using jrepl in this instance as is seems insignificant compared to the time it takes to run recursive "icacls" commands :) But I did wonder about the speed hit of jrepl compared to running :strlen+setlocal/endlocal+findstr but for this particular task any minor speed difference isn't worth the time to set up and run the tests.

If the jrepl solution can be tweaked to reliably handle special characters I may prefer it simply due to it consisting of 3 lines of code compared to the length of the other solution.

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#213 Post by dbenham » 23 Jul 2016 16:30

mirrormirror wrote:1: In jrepl, are there any rules for quoting the regex matched groups? For example the $1 is quoted on one example but not in the other:
jrepl ".{%myLen%}(.*)$" $1 /jmatch
jrepl ".{%%N}(.*)" "$1" /jmatch
The quotes are not needed around $1, but I generally like to use them for consistency (but of course I'm not really consistent). The rules are the same as for with any batch argument. Any argument that contains any of the token delimiters <space>, <comma>, <semicolon>, <equal>, <tab>, or <0xFF> must be quoted. Arguments that contain poison characters like & | < > should be quoted, unless you want to escape them.

mirrormirror wrote:2: I did not see the ".length" property documented in jrepl. Can you give a bit of info. on this and if there are any other properties like this that can be used? From your example:
jrepl "^.*" "$0.length+1"
That is a standard JScript string property. You have access to the entire JScript language when you use the /J or /JMATCH options. I only documented the global non-standard objects that I define within JREPL.

mirrormirror wrote:3: The jrepl solution fails to properly trim the output on the crazy folder name...
I don't see what you are driving at. I especially don't see a trim issue. I do see a percent in your definition of directory that gets stripped, but that has nothing to do with JREPL. If you want a percent in the value, then you have to double the percent in the line that defines the variable.

mirrormirror wrote:
It is easy to solve the problem with JREPL with a minimal amount of code, but it really is actually significantly slower due to start up times for each JREPL instantiation.
I'm not super concerned with the added delay of using jrepl in this instance as is seems insignificant compared to the time it takes to run recursive "icacls" commands :) But I did wonder about the speed hit of jrepl compared to running :strlen+setlocal/endlocal+findstr but for this particular task any minor speed difference isn't worth the time to set up and run the tests.

If the jrepl solution can be tweaked to reliably handle special characters I may prefer it simply due to it consisting of 3 lines of code compared to the length of the other solution.
JREPL is designed to handle all possible characters, one way or another. But you would have to show me a specific problem that you are having. I am sure there is a simple solution.


Dave Benham

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#214 Post by mirrormirror » 23 Jul 2016 16:39

But you would have to show me a specific problem that you are having. I am sure there is a simple solution.

If you run this code you can see the issue:

Code: Select all

@echo off &setlocal disableDelayedExpansion
SET "directory=1% . a! b! c! ^ 'name1 = name +2"
IF NOT EXIST "%directory%" MD "%directory%"

for %%F in (
  "c:\Program Files (x86)"
  "c:\Program Files\Common Files"
  "%directory%"
  .
  someInvalidPath
) do (
  echo CurrentFolder: __________ %%~F
  for /f %%N in ('echo %%~F^|jrepl "^.*" "$0.length+1" /j') do (
    icacls "%%~F" 2>&1 | jrepl ".{%%N}(.*)" "$1" /jmatch /exc -1
  )
  echo(
)

Notice the <space> preceedint the username in the 2nd example (output truncated for clarity) - right before BUILTIN\Administrators:

Code: Select all

CurrentFolder: __________ c:\Program Files\Common Files
NT SERVICE\TrustedInstaller:(F)
.....

CurrentFolder: __________ 1 . a! b! c! ^ 'name1 = name +2
 BUILTIN\Administrators:(I)(F)

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#215 Post by mirrormirror » 23 Jul 2016 17:25

In addition to my response above I discovered another issue with the way the FOR loops strip out percents - it affects the test cases also - detailed more here:

http://www.dostips.com/forum/viewtopic.php?f=3&t=7305&p=48003#p48003

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#216 Post by dbenham » 23 Jul 2016 17:52

I see the problem. Again, it has nothing to do with JREPL.

The file name with the caret gets corrupted when I echo it unquoted through the pipe. The situation is even worse if the folder name contains &.

I see two possible solutions:

1) Abandon the pipe and use the JREPL /S option to read the value from a variable

Code: Select all

@echo off
setlocal disableDelayedExpansion

for %%F in (
  "c:\Program Files (x86)"
  "c:\Program Files\Common Files"
  .
  asdfasdf
  "1 . a! b! c! ^ 'name1 = name +2"
  "A&B"
) do (
  echo CurrentFolder: __________ "%%~F"
  set "folder=%%~F"
  for /f %%N in ('jrepl "^.*" "$0.length+1" /j /s folder') do (
    icacls "%%~F" 2>&1 | jrepl ".{%%N}(.*)" "$1" /jmatch /exc -1
  )
  echo(
)
However, I think there may be an obscure issue with extended ASCII characters when JREPL reads from a variable.

The other option is to use delayed expansion with the pipe:

Code: Select all

@echo off
setlocal disableDelayedExpansion

for %%F in (
  "c:\Program Files (x86)"
  "c:\Program Files\Common Files"
  .
  asdfasdf
  "1 . a! b! c! ^ 'name1 = name +2"
  "A&B"
) do (
  echo CurrentFolder: __________ "%%~F"
  set "folder=%%~F"
  for /f %%N in ('cmd /v:on /c echo !folder!^|jrepl "^.*" "$0.length+1" /j') do (
    icacls "%%~F" 2>&1 | jrepl ".{%%N}(.*)" "$1" /jmatch /exc -1
  )
  echo(
)


Or you could use the batch strlen function to get the length of the path, and only use JREPL to print out the results of ICALC :mrgreen:


Dave Benham

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#217 Post by mirrormirror » 23 Jul 2016 18:09

Ok, thanks again - I appreciate your attention to detail and in writing up nice code (i.e. adding extra error handling & stripping out endlines, etc.). For me, these posts are not just about finding immediate solutions, but also learning. I think I have my solution.

One more question...

Concerning the :strlen function. The one I used (I think I got it from SO) is here:

Code: Select all

:strlen <resultVar> <stringVar>
(   
    setlocal EnableDelayedExpansion
    set "s=!%~2!#"
    set "len=0"
    for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
        if "!s:~%%P,1!" NEQ "" (
            set /a "len+=%%P"
            set "s=!s:~%%P!"
        )
    )
)
(
    endlocal
    set "%~1=%len%"
    exit /b
)

aGerman used the one from here:
http://www.dostips.com/DtTipsStringOperations.php#Function.strLen

Are there and advantages/reasons to use one of these solutions over the other?

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#218 Post by dbenham » 23 Jul 2016 20:41

That is really off topic for this thread, but...

I don't think there is much substantive difference. They both use the same algorithm.

I think jeb's version is every so slightly more efficient (splitting hairs really). I prefer the calling sequence of the DOS Tips version, where the string is first, and the return variable is 2nd. But that is really cosmetic.

I haven't had much need for strlen recenly, but when I do use it, I usually take jeb's SO version, but rework it to swap the arguments.

The algorithm was developed (or adapted) for batch at viewtopic.php?p=5385, and there is an explanation at viewtopic.php?p=5537#p5537


Dave Benham

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#219 Post by mirrormirror » 28 Jul 2016 16:26

Hello Dave, I have a feature request for your next release of jrepl :)

Based on my most recent help request in this forum here: http://www.dostips.com/forum/viewtopic.php?f=3&t=6044&start=195#p47986

Could you add a straight text SEARCH / REPLACE without using regex? Based on my prior issue where regex can have difficulty finding literal strings containing backslashes "\". I often work with file paths (as I suppose many others here do) and backslashes are omnipresent :)

A complete wishlist would be:
- LITERAL text search
- Enable / Disable case sensitivity
- Option to output just the search matches (like /JMatch)
- REPLACE functionality
- Other standard jrepl features applied (read from stdin, variable file, etc.)

This is just a wish list for the next time you decide to update the code.

Changing topics slightly. You suggested:

Code: Select all

1) Abandon the pipe and use the JREPL /S option to read the value from a variable
So I've begun trying this and like it. Is there an option put the OUTPUT into a variable? I've checked out the /V option but it looks like it is still related only to searching/replacing rather than OUTPUT.

If there is no option to place the output into a variable - I'd like to add this feature to my "wish list".

Code: Select all

However, I think there may be an obscure issue with extended ASCII characters when JREPL reads from a variable.

I can't think of any cases where I am using extended ascii at the moment, but can you provide any details so I can avoid cases which may fail?

Thank you...

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#220 Post by dbenham » 28 Jul 2016 18:21

mirrormirror wrote:Could you add a straight text SEARCH / REPLACE without using regex? Based on my prior issue where regex can have difficulty finding literal strings containing backslashes "\". I often work with file paths (as I suppose many others here do) and backslashes are omnipresent :)

A complete wishlist would be:
- LITERAL text search
- Enable / Disable case sensitivity
- Option to output just the search matches (like /JMatch)
- REPLACE functionality
- Other standard jrepl features applied (read from stdin, variable file, etc.)

This is just a wish list for the next time you decide to update the code.
:shock:
Seriously :!: :?: :roll:

You couldn't take the time to read the documentation :?: or any of the countless examples within this thread :?:

Everything you requested is already handled.
  • /L option for literal search.
  • /I option to ignore case.
  • /JMATCH to output only matches. It might be nice to have a /MATCH option corollary to avoid user supplied JScript, but that would require significant additional parsing in my code. If all you want is to return matching strings without tranformation, then simply use /JMATCH with "$0" as the replace string.
  • Replace functionality - ummm that tells me nothing
  • It already reads stdin by default, with /F option to read from a file, and /S option to read from a variable

mirrormirror wrote:Changing topics slightly. You suggested:
dbenham wrote:1) Abandon the pipe and use the JREPL /S option to read the value from a variable
So I've begun trying this and like it. Is there an option put the OUTPUT into a variable? I've checked out the /V option but it looks like it is still related only to searching/replacing rather than OUTPUT.

If there is no option to place the output into a variable - I'd like to add this feature to my "wish list".

dbenham wrote:However, I think there may be an obscure issue with extended ASCII characters when JREPL reads from a variable.

I can't think of any cases where I am using extended ascii at the moment, but can you provide any details so I can avoid cases which may fail?

The fundamental concept of JREPL is not conducive to writing the result to an environment variable. A variable can only receive one value, but JREPL can return many values. Even when the input is from a single variable using /S, there can be many outputs if /JMATCH is used.

At one point I developed REPLVAR.BAT precisely to do what you ask. It was an offshoot of REPL.BAT (the precursor to JREPL.BAT). But I ran into problems regarding unicode vs extended ASCII, environment variable vs file, code page issues... :? And so I abandoned the effort. I believe the REPLVAR.BAT issues may also impact JREPL.BAT when using /S.

The information you need is embedded within that REPLVAR.BAT thread, but it quickly gets very confusing. I don't have any interest in climbing down that rabbit hole again to provide any better explanation.


Dave Benham

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#221 Post by mirrormirror » 28 Jul 2016 18:40

You couldn't take the time to read the documentation :?: or any of the countless examples within this thread

:oops: sorry - I skimmed through the documentation, found the /V option and simply focused on that and stopped there.
I've been trying to understand macros in order to get a couple of them written before the weekend and have done a ton of reading the past couple of days in my spare time so - no excuse on my part though.

No worries on the "output to variable" request - I thought about the variable length challenges, etc. and realized there would be challenges.

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#222 Post by dbenham » 30 Jul 2016 08:55

I've created version 4.3 by adding an rpad() function, and improving lpad(). Both functions are useful with the /J and /JMATCH options.

Here is the relevant documentation, extracted from the JREPL /?JSCRIPT help:

Code: Select all

      lpad( value, padString )
      lpad( value, length [,padString] )

               Used to left pad a value to a minimum width string. If the
               value already has string width >= the desired length, then no
               change is made. Otherwise it left pads the value with the
               characters of the pad string to the desired length. If only
               padString is specified, then the value is padded to the length
               of padString. If length is specified with a padString, then
               padString is replicated as needed to get the desired length.
               If length is specified without padString, then spaces are used
               for the padString.

               Examples:
                  lpad(15,'    ')        returns '  15'
                  lpad(15,4)             returns '  15'
                  lpad(15,'0000')        returns '0015'
                  lpad(15,4,'0')         returns '0015'
                  lpad(19011,4,'0')      returns '19011'
                  lpad('A','. . . . .')  returns '. . . . .A'
                  lpad('A',9,'. ')       returns '. . . . .A'
                  lpad('AB','. . . . .') returns '. . . . AB'
                  lpad('AB',9,'. ')      returns '. . . . AB'

      rpad( value, padString )
      rpad( value, length [,padString] )

               Used to right pad a value to a minimum width string. If the
               value already has string width >= the desired length, then no
               change is made. Otherwise it right pads the value with the
               characters of the pad string to the desired length. If only
               padString is specified, then the value is padded to the length
               of padString. If length is specified with a padString, then
               padString is replicated as needed to get the desired length.
               If length is specified without padString, then spaces are used
               for the padString.

               Examples:
                  rpad('hello','          ')  returns 'hello     '
                  rpad('hello',10)            returns 'hello     '
                  rpad('hello',' . . . . .')  returns 'hello. . .'
                  rpad('hello',,10,' .')      returns 'hello. . .'
                  rpad('hell',' . . . . .')   returns 'hell . . .'
                  rpad('hell',10,' .')        returns 'hell . . .'
                  rpad('hello',2)             returns 'hello'
 


And here is JREPL.BAT version 4.3
JREPL4.3.zip
(12.14 KiB) Downloaded 985 times


Dave Benham

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#223 Post by dbenham » 02 Aug 2016 18:10

Version 4.4 fixes a bug with the /C option - the line count was off by 1 when the last line did not end with line feed.
JREPL4.4.zip
(12.2 KiB) Downloaded 924 times


Dave Benham

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#224 Post by foxidrive » 03 Aug 2016 17:20

Love your work, Dave.

I checked out EXC and INC in the docs - neat stuff!
/N minwidth is very useful too.

These are all too good to hide in the documentation. :D

EXC excludes lines from the source file by line number or by negative number from the bottom of the file. Lots of numbers can be excluded.
INC includes lines in the same way.
/N minwidth numbers each line and can pad the number to a certain number of places.

Dave, can I suggest that /N use a pipe instead of a colon after the number, or better still have an option for that character?

EG: /N 3 "|"

That would allow extra parsing of the numbered lines in a for-in-do loop and be able to control which character at the start of the line are filtered out with the "DELIMS=|" option.

I was also looking for the switch to write the output to an environment variable but I couldn't see one in searching the docs.

The /V documentation seems unclear and I wondered if that was it.
I tried using /v name just in case but got this:

Code: Select all

c:\Files\aaa\bat>jrepl "^(.*)" "$1" /v variable  /f file.bat
ERROR: Too many arguments.




In my view Jrepl is better than sliced bread!

(For those who haven't heard the expression it's used as in 'Some useful item is better than sliced bread!')

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

#225 Post by dbenham » 03 Aug 2016 20:43

foxidrive wrote:Love your work, Dave...
...In my view Jrepl is better than sliced bread!
:D Thanks, I do feel that JREPL is a bit of a Swiss Army Knife.

foxidrive wrote:Dave, can I suggest that /N use a pipe instead of a colon after the number, or better still have an option for that character?

EG: /N 3 "|"

That would allow extra parsing of the numbered lines in a for-in-do loop and be able to control which character at the start of the line are filtered out with the "DELIMS=|" option.
:idea: :) Good idea, except I cannot add the delimiter as a second argument to the /N switch because it would break existing scripts. But I can (and did :wink: ) add a /D delimiter option to specify the delmiter. The new option is in version 4.5 at the end of this post.

foxidrive wrote:I was also looking for the switch to write the output to an environment variable but I couldn't see one in searching the docs.

The /V documentation seems unclear and I wondered if that was it.
I tried using /v name just in case but got this:

Code: Select all

c:\Files\aaa\bat>jrepl "^(.*)" "$1" /v variable  /f file.bat
ERROR: Too many arguments.

I just responded to mirrormirror about that very subject in the 2nd half of this post. At one point I wanted to have that feature, but I have abandoned that idea. Update - I ended up implementing this after all in version 6.5 :!: There are too many issues that make it extremely difficult, (actually impossible I think) to provide a robust solution for that feature. Many of those issues are the same as what you face when trying to do text modification with pure batch, which is what drove me to develop JREPL in the first place.

The /V option is actually quite simple. It is a switch - it does not take an argument. Without /V, the search and replace strings are the actual strings, and /JBEG etc strings are the actual code. But with the /V switch, they are interpreted as variable names instead, and the needed values are read from the environment variable.

For example, this silly example

Code: Select all

call jrepl "Y" "N" /jbegln "skip=(ln==5)" /f test.txt
Becomes this if the /V option is used.

Code: Select all

set "find=Y"
set "repl=N"
set "begLn=skip=(ln==5)"
call jrepl find repl /v /jbegln begLn /f test.txt


Here is version 4.5 with the new /D option:
JREPL4.5.zip
(12.34 KiB) Downloaded 842 times


Dave Benham

Post Reply