cli脚本搜索并计算文件

时间:2015-11-23 20:16:08

标签: regex bash sed command-line-interface

我的文件包含

等字符串
    object-group network NAME1
    object-group network OTHERNAME2
    .....
    object-group network OTHERNAME5
    ....
    ... NAME1 ..... 
    ..... OTHERNAME2 ... NAME1  ...... 
    .......

我想知道NAME1,OTHERNAME2,...... OTHERNAME5组成文件的次数。我不知道单词,但字符串从" object-group network"

input file example
 object-group network NAME1
 object-group network NAME2
 object-group network NAME3
 object-group network NAME4
 ....
word word word NAME1 word word
word word word NAME1 word NAME2
word word word NAME3 word word word
word word word NAME1 word NAME3 word NAME2
...

output require
NAME1 4
NAME2 3
NAME3 3
NAME4 1

0 个答案:

没有答案