计算纯文本文件中字符的出现次数 [英] Count occurrences of a char in plain text file

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

问题描述

linux/terminal下有什么办法可以统计纯文本文件中char f出现的次数吗?

Is there any way under linux/terminal to count, how many times the char f occurs in a plain text file?

推荐答案

这个怎么样:

fgrep -o f <file> | wc -l

注意:除了更容易记住/复制和自定义之外,这比 Vereb 的答案快了大约三倍(对不起,编辑!搞砸了第一个测试).

Note: Besides much easier to remember/duplicate and customize, this is about three times (sorry, edit! botched the first test) faster than Vereb's answer.

这篇关于计算纯文本文件中字符的出现次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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