我想数字数,并打印匹配的花纹线,与以下模式完全匹配:
abc-ERROR:
输入文件包含:
# abc-ERROR: xyxxkkfgfr
# def-Error: aaaaaa
# abc-ERROR.cpp产出应是:
 1   (count)
 # abc-ERROR: xyxxkkfgfr   (line)发布于 2013-04-17 09:49:35
您可以使用grep获取行数,使用grep -c获取行数。如果您不喜欢运行两次grep,可以使用tee和进程替换(下面是bash语法):
grep abc-ERROR: input.txt | tee >( wc -l )https://unix.stackexchange.com/questions/72728
复制相似问题