Search found 2429 matches

by dbenham
13 Sep 2023 07:40
Forum: DOS Batch Forum
Topic: [SOLVED] grep + HTML angle brackets?
Replies: 3
Views: 8972

Re: grep + HTML angle brackets?

The following works fine for me on GNU grep 2.5.1 C:\>grep -Poha "<h2>" input.html Windows command line treats quoted angle brackets as literals. I don't think this is a command line issue, unless possibly your actual command is more complicated than what you are showing, causing the search string t...
by dbenham
06 Sep 2023 04:41
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 550
Views: 2166379

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

Good job.
You can simplify by using the predefined counter variable that is already initialized to 0

Code: Select all

jrepl "\[AddReg\]" "$txt=++counter==2?$0+'\r\nTestLine.':$0" /jq /f "test.txt" /o "test1.txt"
Dave Benham
by dbenham
27 Aug 2023 07:14
Forum: DOS Batch Forum
Topic: why does del /q "" work like del /q *.* and ruin me
Replies: 3
Views: 9798

Re: why does del /q "" work like del /q *.* and ruin me

Ouch! It has been a long while since I have spent much time with batch scripts or Windows command line, but I don't remember ever seeing this abomination. I ran some additional tests, and all of the following are treated like DEL * del "" del " del """""" del . del "." del ". My guess is that all th...
by dbenham
27 Aug 2023 05:47
Forum: DOS Batch Forum
Topic: JREPL.BAT and UTF auto detect?
Replies: 3
Views: 8354

Re: JREPL.BAT and UTF auto detect?

No - there is no auto detection of encoding.

Use the /UTF option if all input and output is UTF-16LE

For more encoding flexibility you must use the ADO charset options available to /F and /O.

Use JREPL /?/F and JREPL /?/O to get help on using ADO character sets
by dbenham
20 May 2023 12:15
Forum: DOS Batch Forum
Topic: Event-driven multi-thread scheme for Batch files
Replies: 16
Views: 31674

Re: Event-driven multi-thread scheme for Batch files

That swaps stderr and stdout, so stdout messages go to 2, and stderr messages go to 1

See https://stackoverflow.com/a/12274145/1012053 for more information
by dbenham
23 Mar 2023 07:47
Forum: DOS Batch Forum
Topic: How to put inner quotes in outer quotes in "for" loop?
Replies: 17
Views: 44287

Re: How to put inner quotes in outer quotes in "for" loop?

I don't understand what you are trying to do, so I have no idea how to solve your problem. It sounds like you are trying to communicate between different processes, which would require communication via files. I use that technique in my SNAKE.BAT batch game. Buried in that thread is a description of...
by dbenham
01 Sep 2022 21:20
Forum: DOS Batch Forum
Topic: ECHO. FAILS to give text or blank line - Instead use ECHO/
Replies: 44
Views: 249313

Re: ECHO. FAILS to give text or blank line - Instead use ECHO/

We have all been down that road - it simply looks wrong. But the countless experiments don't lie - it really is the only option that always works (except for some esoteric CALL situations, which should rarely be needed)
by dbenham
07 Jul 2022 16:28
Forum: DOS Batch Forum
Topic: How to put inner quotes in outer quotes in "for" loop?
Replies: 17
Views: 44287

Re: How to put inner quotes in outer quotes in "for" loop?

I am lurking in the shadows. :twisted: Actually I have found another hobby that has been sucking up my time - VCV Rack, a Eurorack modular synth emulator for the computer. I am learning all I can about synthesis, as well as creating patches that play themselves so I can use them as accompaniment for...
by dbenham
08 Mar 2022 11:31
Forum: DOS Batch Forum
Topic: How to put inner quotes in outer quotes in "for" loop?
Replies: 17
Views: 44287

Re: How to put inner quotes in outer quotes in "for" loop?

I am not familiar with dsquery.exe, so I don't know if the commas in OU=MyOU,dc=mydomain,dc=local-l are important, or if they can be converted to spaces. But the FOR /F will convert unquoted commas into spaces. If that is the problem, then I think the following should work: FOR /F "tokens=*" %%a IN ...
by dbenham
03 Feb 2022 20:06
Forum: DOS Batch Forum
Topic: more tricks with certutil
Replies: 13
Views: 46082

Re: more tricks with certutil

Yes, it is frustrating when something has the potential to be extremely useful in a general sense, but then has a limitation that interferes with achieving the full potential.
by dbenham
11 Apr 2021 19:44
Forum: DOS Batch Forum
Topic: Clobbered cmd.exe!
Replies: 7
Views: 15315

Clobbered cmd.exe!

WTF :shock: :!: :evil: I just discovered my cmd.exe is suddenly missing, as are all my utility files that I keep in d:\utils and include in my PATH. God only knows what else is amiss. I did manage to find a copy of cmd.exe in Windows\SysWOW64. I think it happened a couple weeks ago when my computer ...
by dbenham
09 Apr 2021 16:36
Forum: DOS Batch Forum
Topic: Is there a way to obfuscate parts of a batch file?
Replies: 3
Views: 11639

Re: Is there a way to obfuscate parts of a batch file?

Also check out - https://www.dostips.com/forum/viewtopic.php?f=3&t=7990. Lots of good techniques there for obfuscating code. Nothing to obfuscate select portions, but that could certainly be developed. I feel like this topic has been explored fairly extensively, and I'm not too interested in revisit...
by dbenham
17 Mar 2021 06:59
Forum: DOS Batch Forum
Topic: Using multiple strings for FINDSTR - is this OK?
Replies: 3
Views: 11385

Re: Using multiple strings for FINDSTR - is this OK?

Variables to the rescue @echo off setlocal ::-- Define search strings set critical=/I^ /C:"ORA-"^ /C:"Fetch of Driver Member"^ /C:"Error: 3303"^ /C:"Error: 3304"^ /C:"Error: 3335"^ /C:"Error: 3336"^ /C:"Error: 3337"^ /C:"does not exist for the specified cube or you do not have access to it"^ /C:"Out...
by dbenham
03 Mar 2021 14:53
Forum: DOS Batch Forum
Topic: Foxidrive has left us
Replies: 44
Views: 211640

Re: Foxidrive has left us

The 15th post in this thread says he died at 57 :(
Much too young.