grep统计某个单词的个数
2007-08-25 10:51
253 查看
j@j:~$ cat hello.c
#include<stdio.h>
//include include
int main(){
printf("hello world/n");
exit(0);
}
j@j:~$ grep -o include hello.c
include
include
include
如上所示, 所有的include都显示出来了, 包括有两个include的行。
命令grep -c -o include hello.c的结果是2, -c参数只能统计行。如果要统计个数, 可以再来个重定向:
grep -o include hello.c | grep -c include
得到include的个数 3
#include<stdio.h>
//include include
int main(){
printf("hello world/n");
exit(0);
}
j@j:~$ grep -o include hello.c
include
include
include
如上所示, 所有的include都显示出来了, 包括有两个include的行。
命令grep -c -o include hello.c的结果是2, -c参数只能统计行。如果要统计个数, 可以再来个重定向:
grep -o include hello.c | grep -c include
得到include的个数 3
相关文章推荐
- 统计字符串中单词的个数
- c++经典题----统计一个文件“is”单词的个数
- 统计文本英文单词总个数,并列出每个单词的个数
- hdu 1251 统计难题(给定字典单词,查询以某单词为前缀的单词的个数)
- 如何统计一段英文中的单词的个数
- 统计字符串中单词的个数
- 统计字符串中单词的个数
- 使用tuple统计文件中单词的个数
- C—输入一个字符串 统计其中单词的个数
- Vector实现统计输入单词的个数
- 【笔试】45、统计文件中单词的个数
- C++文件中读单词并统计输出改单词及其个数
- 统计文本中每个单词的个数
- 第四章实验:统计文本单词的个数
- 第十六周项目二:用指针玩字符串(4) :统计句子str中单词的个数
- 使用python统计出txt文档中含有某个单词的个数
- 第二学期第二周任务三之统计字符串中单词的个数
- C语言统计一篇英文短文中单词的个数实例代码
- C语言算法--统计字符串中单词的个数
- 第十六周项目2-用指针玩字符串(任务四:统计单词的个数)