[root@7 test]# cat 7.txt
7
(
7
7
q
7
7
q
7
7
q
7
)
7
7
7
7
7
7
7
[root@7 test]# awk '/\(/,/\)/ { if (/7/) i++ } END { print i }' 7.txt
7
Linux从入门到放弃 awk if判断
最新推荐文章于 2024-11-22 15:17:22 发布
[root@7 test]# cat 7.txt
7
(
7
7
q
7
7
q
7
7
q
7
)
7
7
7
7
7
7
7
[root@7 test]# awk '/\(/,/\)/ { if (/7/) i++ } END { print i }' 7.txt
7