grep -n pattern filename
With the line number use tail +
Command option to print the number of occurences
grep -c pattern filename
or
grep pattern filename | wc -l
To see the last occurrences
tail -1000 filename | grep pattern
General notes about J2EE,Spring and Hibernate technologies and some SQL.