【发布时间】:2015-03-30 17:22:05
【问题描述】:
我想跨多个文件 grep 并显示结果的唯一性和计数。例如:
filea:
text1
text2
text3
fileb:
text1
text3
filec:
text2
text3
grep -r "text*" ???
output:
text1 2
text2 2
text3 3
【问题讨论】:
标签: recursion count grep unique
我想跨多个文件 grep 并显示结果的唯一性和计数。例如:
filea:
text1
text2
text3
fileb:
text1
text3
filec:
text2
text3
grep -r "text*" ???
output:
text1 2
text2 2
text3 3
【问题讨论】:
标签: recursion count grep unique
试试这个:
awk '/text/{a[$0]++}END{for(x in a)print x,a[x]}' file*
我没有测试过,但应该可以。
【讨论】: