grep可以用于过滤hello行,通过wc -l就可以统计有多少行。比如 cat filename | grep hello | wc -lwc是word count的缩写,专门用于统计输出数据的。-l是统计有多少行。
grep -o 'hello' filename|wc -l