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

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

问题描述

在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?

推荐答案

p>如何:

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.

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

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