[英]Finding word and number of lines in Unix
I am trying to find the number of lines that contain the word. 我试图找到包含单词的行数。 I realize this is possible with the
wc
command and the -l
flag, but I'm not 100% sure how to do it. 我意识到使用
wc
命令和-l
标志是可行的,但是我不确定100%如何做到这一点。 Any ideas? 有任何想法吗?
您可以使用grep代替wc,如下所示:
grep -c "word" file
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.