I want to search for a string and find the number of occurrences in a file using the vi editor.
:g/xxxx/d
This will delete all the lines with pattern, and report how many deleted. Undo to get them back after.