Search for string and get count in vi editor

kadeshpa picture kadeshpa · Apr 3, 2009 · Viewed 131.5k times · Source

I want to search for a string and find the number of occurrences in a file using the vi editor.

Answer

Gustavo picture Gustavo · Oct 13, 2010

THE way is

:%s/pattern//gn