in reply to Re^2: grep command
in thread grep command

Almost!

However, the last line in which "hello" is found is printed twice.

CLI: perl -n -e "print, $count++ while /\bhello\b/g; END { print $count }" hello.out
        (quotes revised for windows)

file hello.txt:
hello. hellow, world. bye
world says hello.
bye
hello, hellow, hello
not now.
done.

output
hello. hellow, world. bye
world says hello.
hello, hellow, hello
hello, hellow, hello
4