silentNinJa
silentNinJa

Reputation: 450

number of occurences of a word in a part of file in vim

Suppose I would like to find the number of occurrences of the word 'asd' in a part of file, eg., from line 21 to line 234. How would I do that in VIM?

Upvotes: 2

Views: 90

Answers (1)

Eric Fortis
Eric Fortis

Reputation: 17360

Try this for counting :21,234s/asd//gn

Edit

Since your vim is so old, try greping and count like

sed -n 21,234p filename | grep -o asd | wc -l

Upvotes: 3

Related Questions