I want to search for a string and find the number of occurrences in a file using the vi editor.
:%s/string/string/g will give the answer.