awk -F "" '{for(i=1;i<=NF;++i) if($i=="a") ++sum}END{print sum}' test.c
[root@xiaobb 5906]# awk '{for(i=1;i<=NF;++i) if($i=="test") ++sum}END{print sum}' test.c
6
[root@xiaobb 5906]# cat test.c
test test
ktest
test
a test
test a
l test
ltest
[root@xiaobb 5906]# awk '{for(i=1;i<=NF;++i) if($i=="test") ++sum}END{print sum}' test.c
6
[root@xiaobb 5906]# cat test.c
test test
ktest
test
a test
test a
l test
ltest