Solved Parameter to print only if match not found

November 11, 2011 at 13:52:22
Specs: Win7, 4gb
Hi,

I am searching through a bunch of files in a directory and want to redirect the file name of any file that does not contain the "run completed" string, as this would indicate that the run was not successful.

What I am looking for is something similar to the /m parameter:

/m : Prints only the file name if a file contains a match.

...but I want it to print only the file name if the file DOES NOT contain a match.

So what can I add to it?

findstr /i /c:"run completed" *.log >> _pass_fail_results.log

Thanks!


Thanks,
REMGU


See More: Parameter to print only if match not found

Report •

#1
November 11, 2011 at 14:52:55
Combine /m with /v.

findstr /m /v /i /c:"run completed" *.log >> _pass_fail_results.log


Report •

#2
November 11, 2011 at 14:57:15
✔ Best Answer
pushd Your_Folder
for %%j in (*.log) do type "%%j" | find /I "run completed" >nul || echo.%%j >>  _pass_fail_results.log
popd


Report •

#3
November 14, 2011 at 07:18:15
Thanks. Combining /m with/v just printed all the file names in the dir but the pushd method worked as I needed.

Thanks,
REMGU


Report •
Related Solutions


Ask Question