假设我写了一个grep
查询,找出一个方法调用的发生,像这样的对象:有没有办法在grep找出有多少行符合grep结果?
// might not be accurate, but irrelevant
grep -nr "[[:alnum:]]\.[[:alnum:]](.*)" .
这将使许多成果。如何找出有多少这样的结果?
假设我写了一个grep
查询,找出一个方法调用的发生,像这样的对象:有没有办法在grep找出有多少行符合grep结果?
// might not be accurate, but irrelevant
grep -nr "[[:alnum:]]\.[[:alnum:]](.*)" .
这将使许多成果。如何找出有多少这样的结果?
如何使用| wc -l
来计算结果行数?
什么
man grep | grep "count"
它输出
-c, --count
Suppress normal output; instead print a count of matching lines for each input file. [...]
我试过grep -cnr,但它给了我完全意想不到的结果。 – CodeBlue 2012-04-16 19:43:30
它给出每个文件的计数。顺便说一下,如果你想单独匹配而不是线条,请注意 - 只匹配。 – 2012-04-16 20:18:09
如果你只想行数,用'厕所-l' – sinelaw 2012-04-16 19:30:42
好的,什么是三个数字,我看到了什么? – CodeBlue 2012-04-16 19:32:06
好吧,明白了。换行符,字和字节数。 – CodeBlue 2012-04-16 19:32:55