vim文件中某个单词出现的次数 [英] number of occurences of a word in a part of file in vim

查看:85
本文介绍了vim文件中某个单词出现的次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想在文件的一部分中找到单词asd"的出现次数,例如,从第 21 行到第 234 行.我将如何在 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?

推荐答案

试试这个:21,234s/asd//gn

编辑

既然你的vim太老了,试试greping和count like

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

sed -n 21,234p 文件名 |grep -o asd |wc -l

这篇关于vim文件中某个单词出现的次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆