In VIM I use this to find out the number of lines containing a pattern:
:!egrep pattern % | wc -l
For example, to count the lines ending with a 6.
:!egrep '6$' % | wc -l
Deleting all empty lines:
:g//d
Deleting all commented lines (with a // comment) – looks crazy:
:g/\/\//d
Uncommenting all lines in a file.
Actually I use a comments plugin for that, so visual selection + CTRL-R would be my pick, but this is another way to do it, and a general way to delete a certain part in the beginning of a(ll) line(s). This looks even crazier:
:%s/\/\/\(.\+\)/\1