最干净的解决方案是 grep -Po "(?<=')[^']+(?=')"
$ cat file
Unable to find latest released revision of 'CONTRIB_046578'
Unable to find latest released revision of 'foo'
Unable to find latest released revision of 'bar'
Unable to find latest released revision of 'CONTRIB_046578'
# Print occurences
$ grep -Po "(?<=')[^']+(?=')" file
CONTRIB_046578
foo
bar
CONTRIB_046578
# Count occurences
$ grep -Pc "(?<=')[^']+(?=')" file
4
# Count unique occurrences
$ grep -Po "(?<=')[^']+(?=')" file | sort | uniq -c
2 CONTRIB_046578
1 bar
1 foo
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2681 次 |
最近记录: |