|
Answer» I have a stats file that generated on the hour and it includes the following in it. What I need to do is if the failed reaches above 0 then reset the service that is running this. I am not sure what the code is to check a certain line in the stat.txt file like row 10 can anyone help with this one?
Statistics of (myserver/3300, 11:00:00) ----------------------------------------------------------------------------
AVERAGE Queue Time Total Pending Executing COMPLETED Failed ========================================================================== 0.00 2451 0 0 2439 12
what (number) line do you want to check? Thanks for responding I attached the txt file and the line I need to check is under failed. So if under failed the number is above 0 I need to reset the service.
[Saving space - attachment deleted by admin]So it's always the 11th line? (that's what i was asking)Yes SirCode: [Select]@echo off
REM Open stats.txt REM skip 10 lines and read 11th line REM in 11th line isolate 6th space DELIMITED token REM PUT it in an arithmetic (numerical) variable REM check if greater than zero
for /f "skip=10 tokens=1-6 delims= " %%1 in (stats.txt) do set /a fails=%%6
echo number of fails: %fails%
if %fails% GTR 0 goto failure goto success
:failure echo failure count greater than zero goto next
:success echo failure count equal to zero
:next
Very nice I TESTED this out and it works perfect.
Thank you for your valuable time and help with this. You are very welcome.
|