debian:~/Desktop# cat 2
hello ddasd hello eehello
defdfhello
debian:~/Desktop# grep -o hello 2|wc -l
4
debian:~/Desktop# sed 's/hello/&\
/g' 2 | grep -c hello
4
debian:~/Desktop# tr -d "\n" < 2| perl -e '$_=<STDIN>;print s/hello//g'
debian:~/Desktop# xargs -n1 <2|grep "hello"|wc -w
4
debian:~/Desktop# awk -F"hello" '{sum+=NF;sum-=1} END{print sum}' 2
4
debian:~/Desktop# sed 's/hello/hello\n/g' 2 |sed -n -e '/hello/p'|awk -F"hello" '{sum+=NF;sum-=1} END{print sum}'
4
debian:~/Desktop# sed 's/hello/\nhello\n/g' 2|grep -c hello
4
|