shell统计文件中某个字符串出现的个数

例:在a.txt ‘abc’ 字符串出现的个数

方法1:

$ grep -0 ‘abc’ <a.txt|wc -l

$ 36

方法2:

$ cat a.txt |grep “abc” |wc -l

$ 36

统计的结果会直接出来

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>