This question is pretty similar to this question.
I've been stuck trying to count how many a string appears between brackets. Consider the follow text file(although it looks like a .bat script)
(
echo a
echo b
echo c
)
echo z
In the file above, we can see 4 echo, but I only want to count the ones inside the brackets(the result should be 3)
for /f "delims=][ tokens=2" %%H in ('FART.exe -c -i -p %File% ^( a') do set /a count+=1
This code works, but only counts 1, because I couldn't figure out how to count multiple appearances. Please help me, any help will be appreciated.
Edit - 5/7/17
You can assume
- There would be only 1
echoon each line. - Parentheses are not nested
echowould not appear on the same line as parentheses- Bonus if you can make your script count the
echoon the same line of parentheses
- Bonus if you can make your script count the