it will print out "NO ORA-ERROR found"
Code: Select all
if (findstr "ORA-[0-9]" alert_OCEAN_test.log neq 0) (
echo NO ORA-ERROR found>>%output%
)
Moderator: DosItHelp
Code: Select all
if (findstr "ORA-[0-9]" alert_OCEAN_test.log neq 0) (
echo NO ORA-ERROR found>>%output%
)
Code: Select all
findstr "ORA-[0-9]" alert_OCEAN_test.log
If %ERRORLEVEL% EQU 1 echo NO ERROR FOUND>>%output%
Code: Select all
findstr "ORA-[0-9]" "alert_OCEAN_test.log" >nul || echo NO ORA-ERROR found>>%output%
Code: Select all
findstr "ORA-[0-9]" alert_OCEAN_test.log
If ERRORLEVEL 1 echo NO ERROR FOUND>>%output%
mfm4aa wrote:or use the ERRORLEVEL function:
This catches all errorlevels above zero.
Code: Select all
findstr "ORA-[0-9]" "alert_OCEAN_test.log" >nul
If %ERRORLEVEL% EQU 1 echo NO ERROR FOUND>>%output%
If ERRORLEVEL 2 echo An error occured in Findstr & Pause
foxidrive wrote:This is a method that runs when the errorlevel is true.
The || runs statements when errorlevel is true and && runs statements when the errorlevel is false.Code: Select all
findstr "ORA-[0-9]" "alert_OCEAN_test.log" >nul || echo NO ORA-ERROR found>>%output%
Your method above will not do anything if the errorlevel is above 1 although that is usually an error condition.
mfm4aa wrote:or use the ERRORLEVEL function:Code: Select all
findstr "ORA-[0-9]" alert_OCEAN_test.log
If ERRORLEVEL 1 echo NO ERROR FOUND>>%output%
This catches all errorlevels above zero.