vim: How to count the number of certain characters?

How to count a certain character in a large file, such as the number of the word apple?

In command mode:

:% s / apple / apple / ng

This will show at the bottom how many apples are matched. In fact, the second apple can be any character, just to prevent misplacement.

If you enter:

:%s/apple/banana/g

See clearly that there is no n, you will replace all apples with banana 

Guess you like

Origin blog.csdn.net/sinat_39416814/article/details/106252704