title: assinging `grep "string"|wc -l` into a variable in batch scripting
body: <p>I am trying to develop a batch equivalent (windows) code of below unix script:-</p>
  
  <pre><code>i=`grep "ora-error" *.txt|wc -l`
  if [ i -gt 0 ]; then
  echo "true"
  else
  echo "false"
  fi
  </code></pre>
  
  <p>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...</p>
  
  <p>ie. when I use "find /c "ora-error" *.txt" below is the output</p>
  
  <p>---------- xx.TXT: 0</p>
  
  <p>---------- yy.TXT: 0</p>
  
  <p>---------- zz.TXT: 0</p>
  
  <p>I want to take the count and redirect valur into a IF condition.</p>
  
  <p>I need a window script to solve this issue.</p>
  
  <p>Can any body help on this...</p>
  
  <p>Thanks in advance..</p>
  
  <p>with regards </p>
  
  <p>sree</p>
  
  <p>Guys worked out a solution....</p>
  
  <pre><code>find /c "ora-error" *.txt&gt;TEST1.txt
  find /c "0" TEST1.TXT&gt;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
  </code></pre>