Search found 2347 matches

by dbenham
17 Jun 2020 06:00
Forum: DOS Batch Forum
Topic: JREPL to check 12 columns for a certain string?
Replies: 2
Views: 296

Re: JREPL to check 12 columns for a certain string?

Quite simple actually. You just need to write a regex that matches lines to be deleted and use the /R option to reject lines that match and the /XSEQ option to enable substitution of \c for ^ and \q for " The \c is needed due to the pesky doubling of ^ when using CALL call jrepl "\c(?:[\c,]*,){4}(?:...
by dbenham
06 Jun 2020 11:33
Forum: DOS Batch Forum
Topic: Redirect output to file without using > sign?
Replies: 10
Views: 710

Re: Redirect output to file without using > sign?

@echo off call :writeFile >output.txt exit /b :writeFile - All output from this routine will be written to output.txt echo Line 1 echo Line 2 echo etc. exit /b Or, if you already have existingScript.bat that writes your desired output to the console (stdout), then from the console command line: c:\...
by dbenham
01 Jun 2020 20:37
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.5 - regex text processor with support for text highlighting and alternate character sets
Replies: 463
Views: 345958

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

You should have no problem removing \r (carriage return) in the middle of a line without the /M option. You can remove all \r that are not part of the standard \r\n end of line with the following: call jrepl "\r" "" /f "file.txt" /o - As each line is read, the \r\n end of line is automatically strip...
by dbenham
29 May 2020 06:38
Forum: DOS Batch Forum
Topic: Batch rename
Replies: 3
Views: 533

Re: Batch rename

I originally forgot to left zero pad the number to 4 digits. I edited my prior post to add the padding
by dbenham
29 May 2020 05:50
Forum: DOS Batch Forum
Topic: Batch rename
Replies: 3
Views: 533

Re: Batch rename

This is trivial with JREN.BAT - a hybrid JScript/batch regular expression renaming utility call jren "^.*" "lpad($n,'0000')+'.jpg'" /j /p "c:\pathToYourFolder" /rfm "^[a-z0-9]+$" It is not much more complicated to use pure batch @echo off setlocal enableDelayedExpansion pushd "c:\pathToYourFolder" f...
by dbenham
27 May 2020 14:22
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.5 - regex text processor with support for text highlighting and alternate character sets
Replies: 463
Views: 345958

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

Pipe is a regex meta-character that means alternation (basically an OR operator). Like any meta character, you escape it with a backslash. The /XSEQ and /M options aren't needed. So JREPL "\|" "" /f TEST2.txt /o TEST2b.txt The other option is to use the /L literal option, so the search is treated as...
by dbenham
25 May 2020 10:28
Forum: DOS Batch Forum
Topic: [SOLVED] Extract data to .txt file and then sort new file.
Replies: 10
Views: 902

Re: Extract data to .txt file and then sort new file.

Your original request to preserve the first 3 title lines, and then extract and sort the remaining lines that contain FALSE, can be easily solved with JSORT.BAT , plus a little sideways thinking with your use of FINDSTR. JSORT is a hybrid JScript/batch with a number of useful options: Skip n lines (...
by dbenham
25 May 2020 08:31
Forum: DOS Batch Forum
Topic: Just the total size of a folder & subfolders
Replies: 3
Views: 589

Re: Just the total size of a folder & subfolders

JREN.BAT is a hybrid batch/JScript regular expression file/folder renaming utility. But it also has options that make it useful as a directory listing utility, with the ability to display the total size of all files within a folder (including all subfolders recursively). The following will give the...
by dbenham
25 May 2020 08:03
Forum: DOS Batch Forum
Topic: How to rename filenames so only the first letter of words are capitalized?
Replies: 4
Views: 625

Re: How to rename filenames so only the first letter of words are capitalized?

Assuming you are dealing with English, it is a simple 2 step process with JREN.BAT - a hybrid batch/JScript regular expression renaming utility. First capitalize the first character of every "word". Then convert all extensions to lower case. jren "([a-zA-Z])([a-zA-Z']*)" "uc($1)+lc($2)" /j jren "\.[...
by dbenham
23 May 2020 05:59
Forum: DOS Batch Forum
Topic: Self Updating Continuously Running Batch
Replies: 7
Views: 776

Re: Self Updating Continuously Running Batch

It is hard to imagine a scenario where a self modifying batch file is the best option. It is almost always simpler have static code with various options built in, and use logic to execute the appropriate code. The only case I can think of where self modifying code might be handy is if the end user d...
by dbenham
22 May 2020 08:57
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
Replies: 44
Views: 28376

Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like

For some reason I can't get it to execute properly. When I launch it, it seems to be calling cscript.exe but it hangs there. Any ideas what to do about this? That is the designed behavior - it is waiting for input on stdin. It will continue to wait (seemingly hang) until the stdin is closed. You co...
by dbenham
20 May 2020 08:55
Forum: DOS Batch Forum
Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
Replies: 65
Views: 55936

Re: JREN.BAT v2.8 - Rename files/folders using regular expressions

I'm' going to leave that coding exercise to you. The entire JScript language is at your disposal. You can include newlines in your output with the correct JScript code.
by dbenham
18 May 2020 07:30
Forum: DOS Batch Forum
Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
Replies: 65
Views: 55936

Re: JREN.BAT v2.8 - Rename files/folders using regular expressions

In general, the built in help (JREN /?) does a good job describing the features of JREN. It is up to you to figure out how to use those features. Plus there are examples throughout this thread. I hope you take the time to scan all the posts. What code would tell JREN.bat version 2.8 to: 1. count Fil...
by dbenham
15 May 2020 15:18
Forum: DOS Batch Forum
Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
Replies: 65
Views: 55936

Re: JREN.BAT v2.8 - Rename files/folders using regular expressions

The /FM must be the name of the folder or file you want, and the /P must be the full path leading up to that file/folder. for %%F in ("%~dp0.") do call jren "^" "size()+' '" /d /j /list /p "%%~dpF" /fm "%%~nxF" > "FolderList1.txt" "%~dp0." expands to "D:\portable\.", which is logically equivalent to...
by dbenham
14 May 2020 09:04
Forum: DOS Batch Forum
Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
Replies: 65
Views: 55936

Re: JREN.BAT v2.8 - Rename files/folders using regular expressions

Question 1 I'm not exactly sure what you are trying to do. If you want only the size of a single folder, like "D:\portable", then specify the root path with /P and specify the specific folder with /FM call jren "^" "size()+' '" /d /j /list /p "d:\" /fm "portable" Note that size() does not need an a...