jimbob, here is what I came up with:
delfiles.cmd
@echo off
set file=clean.txt
call :grep "Number of files to delete:"
set files=%grep%
call :grep "Total size of files to delete:"
set size=%grep%
echo %Files% files of a total size of %size% are to be deleted.
exit /b 0
:grep
setlocal
for /F "tokens=2 delims=:" %%i in ('findstr /i /c:"%~1" "%file%"') do (
for /F "tokens=1 delims= " %%j in ("%%i") do set _find=%%j
)
endlocal& set grep=%_find%
exit /b 0
This is a re-usable script, as the file and strings can be changed with the same results. I copied/pasted your example and it worked good.
@Patrick Cuff: you might run into problems finding a whole string without the /c:".." part. Might have been a part of the problem, but then maybe my script will give the same results/problems... Live and learn I guess.
______Notes__________
set file= : Set this to the file (and path, if needed) of the file to be scanned.
call :grep "string" : Call the :grep function with the string to find.
set var=%grep% : Set a variable (here files and size) to the answer from :grep.
:grep function: It first looks within the %file% for the "%string%", then parse it at the ':' character, keeping the right-hand part. It then parse it again with 'spaces' and keep the first word. The function returns the variable %grep% which contain the found string.
As with my usual answers, I hope this helps.