001、
[root@localhost test]# ls a.txt [root@localhost test]# cat a.txt ## 测试数据 0aa1 0AA2 03 04 05 06 07 08 09 10 1a1 12 [root@localhost test]# awk '{a = gsub("[Aa]", ""); print a}' a.txt ## 统计每行中A或者a出现的次数 4 0 1
。
001、
[root@localhost test]# ls a.txt [root@localhost test]# cat a.txt ## 测试数据 0aa1 0AA2 03 04 05 06 07 08 09 10 1a1 12 [root@localhost test]# awk '{a = gsub("[Aa]", ""); print a}' a.txt ## 统计每行中A或者a出现的次数 4 0 1
。