Let's assume you want to find the number of ocurrences of a string in a big XML file, quickly.
Let the filename be 'properties.xml', the keyword string be '<property>', and the script language be Perl. Then, the following command will print the total number of occurrences:
perl -lnwe '$a+=()=/\Q<property>/g; }{ print $a;' properties.xml