The unix shell grep command have an option called "-c" which will give you the count of matching lines per file. Sometimes it's desirable to have a summation of all these count, for which i could not find an option. I wrote a one line command that perhaps helped me solve the issue. Thought of sharing it.
for i in
find . -name *.xml; do foo=$(expr $foo +
grep --count "order" $i); echo $foo ;done;
The above command enumerates all the xml files in the current directory and for each xml file, it finds the number of line matching the word "order", and add that count to the variable foo.
Have a good time :-)