I am trying to develop a batch equivalent (windows) code of below unix script:-
i=`grep "ora-error" *.txt|wc -l`
if [ i -gt 0 ]; then
echo "true"
else
echo "false"
fi
tried with "find /c "ora-error" *.txt" but was not able to take the o/p in to variable and redirect the same to if condition...
ie. when I use "find /c "ora-error" *.txt" below is the output
---------- xx.TXT: 0
---------- yy.TXT: 0
---------- zz.TXT: 0
I want to take the count and redirect valur into a IF condition.
I need a window script to solve this issue.
Can any body help on this...
Thanks in advance..
with regards
sree
Guys worked out a solution....
find /c "ora-error" *.txt>TEST1.txt
find /c "0" TEST1.TXT>TEST2.TXT
FOR /F "TOKENS=1* DELIMS=:" %%A IN (TEST2.TXT) DO SET a=%%B
set _count=%a%
IF %_count% EQU 4 goto matched
IF not %_count% EQU 4 goto notmatched
:matched
echo we are in equal to 4 loop
pause
exit
:notmatched
echo we are in not equal to 4 loop
pause
exit