Search found 2244 matches

by dbenham
01 Jun 2019 06:08
Forum: DOS Batch Forum
Topic: why does this code output such result
Replies: 11
Views: 2280

Re: why does this code output such result

Of course adding the quote makes a profound difference - it inverts what is quoted within the value of %str%. Quoted carets don't escape anything in phase 2 - they are simply string literals. Dropping the variable and working just with strings. echo "^A"^B"^A"^B yields "^A"B"^A"B because the A strin...
by dbenham
31 May 2019 06:51
Forum: DOS Batch Forum
Topic: why does this code output such result
Replies: 11
Views: 2280

Re: why does this code output such result

:? I never said that, so I'm not sure why you are reaching that conclusion. Of course both forms pass through phase 2. My original explanation attempts to show a command, and then illustrate the intermediate result of each phase. And here is an example of what I intended in my last post: @echo off s...
by dbenham
30 May 2019 23:07
Forum: DOS Batch Forum
Topic: Safely parse nearly any CSV with pure batch
Replies: 1
Views: 1644

Safely parse nearly any CSV with pure batch

Quite some time ago I developed a hybrid JScript/batch parseCSV.bat utility to assist with parsing CSV files with FOR /F. It could handle any CSV as long as you didn't need to parse more than 32 tokens, and no line approached 8191 bytes. Much later, Aacini started a thread where routines were develo...
by dbenham
30 May 2019 19:42
Forum: DOS Batch Forum
Topic: Safely parse nearly any CSV with parseCSV.bat v1.3
Replies: 10
Views: 11249

Re: Safely parse nearly any CSV with parseCSV.bat v1.3

So parseCSV.bat by itself does not help when you have more than 32 columns to parse. But Aacini began a thread investigating how to access large numbers of columns . Through a group effort, we were able to develop routines to easily access any number of tokens, as many as will fit within the 8191 li...
by dbenham
30 May 2019 07:39
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 440
Views: 205135

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

My previous code works well as long as the input file is not huge (well less than 1GB). But the /M option will cause it to fail if the input is huge. With a bit of extra code, it is possible to do the cut from file1 and append to file2 without /M if you supply additional JScript code: call JREPL "^s...
by dbenham
30 May 2019 06:13
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 440
Views: 205135

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

JREPL normally has only one output (or modifies one output file at a time). But you can supply your own JScript via /JQ if you want to have multiple outputs. Your two search strings in your example are not quite the same, so I don't see how you are currently achieving a cut and paste in two steps. B...
by dbenham
30 May 2019 05:41
Forum: DOS Batch Forum
Topic: why does this code output such result
Replies: 11
Views: 2280

Re: why does this code output such result

Yes - I thought that is what I effectively demonstrated in my explanation. But even if the 3rd ! was not escaped for round 5, it still would not expand to escapeOnly because you have !^^!, not !^!. If you want to get escapeOnly in round 5, then you need to remove the round 5 escape before the 3rd !,...
by dbenham
29 May 2019 08:42
Forum: DOS Batch Forum
Topic: why does this code output such result
Replies: 11
Views: 2280

Re: why does this code output such result

Your code is a goofy test of parsing - vary hard to follow. But it gives the expected result. I assume you are familiar with the various phases involved when parsing batch scripts , including a detailed description of the phase 1 and phase 5 rules for percent and delayed expansion . If not, then you...
by dbenham
25 May 2019 00:35
Forum: DOS Batch Forum
Topic: Safely parse nearly any CSV with parseCSV.bat v1.3
Replies: 10
Views: 11249

Re: Safely parse nearly any CSV with parseCSV.bat

OMG :shock: :oops:

I had a nasty bug in version 1.2 that prevented the /D option from working if /E was also used.

I updated the version to 1.3 in the first post of this thread.


Dave Benham
by dbenham
19 May 2019 20:21
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 440
Views: 205135

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

Steffen (aGerman) discovered how to enable the ANSI escape sequences without resorting to modifying the registry. See series of posts starting at https://www.dostips.com/forum/viewtopic.php?f=3&t=9144&p=59700#p59691 This is useful for the new /H option. Here is version 8.1 JREPL8.1.zip Summary of Ch...
by dbenham
19 May 2019 19:33
Forum: DOS Batch Forum
Topic: Enable ANSI escape sequence within Windows 10 console
Replies: 7
Views: 1274

Re: Enable ANSI escape sequence within Windows 10 console

This is much faster :!: I can't really tell. The first time I launch PowerShell within a given cmd.exe process, it is always S... L... O.... W....... Thereafter it is relatively fast. Unfortunately it doesn't work using cmd.exe which would have been even faster. The cmd seems to reset VT processing...
by dbenham
16 May 2019 11:08
Forum: DOS Batch Forum
Topic: Enable ANSI escape sequence within Windows 10 console
Replies: 7
Views: 1274

Re: Enable ANSI escape sequence within Windows 10 console

Very cool 8) But yes, slow. Even so, I think it may be worth adding as an additional option. Maybe /VT to enable the escape sequences, for those that are desperate for the feature and willing to wait for the slow initialization. JREPL already has significant startup time, and as you have it, there i...
by dbenham
15 May 2019 12:22
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 440
Views: 205135

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

Once I learned how to configure the Windows 10 console to support ANSI escape sequences , I created a new JREPL version that supports highlighting of matched or replaced text. Here is version 8.0 JREPL8.0.zip Summary of Changes C:\>jrepl /?history 2019-05-15 v8.0: Add /Hxxx options for highlighting ...
by dbenham
15 May 2019 10:57
Forum: DOS Batch Forum
Topic: Enable ANSI escape sequence within Windows 10 console
Replies: 7
Views: 1274

Enable ANSI escape sequence within Windows 10 console

Starting with Windows 10, the console supports ANSI escape sequences, but only if the console is configured to NOT "use legacy console", and the program writing to the console must configure its output to interpret the sequences. CMD.EXE was modified such that its internal commands do support the AN...
by dbenham
14 May 2019 10:43
Forum: DOS Batch Forum
Topic: Wait till close by title
Replies: 2
Views: 476

Re: Wait till close by title

Ooh - a bit of snark from aGerman... finally :!: :lol:
and well said.