With a modern grep version it is even more simple: grep -c 'the' /path/to/file.txt I'm to lazy to look up when this feature was introduced. It works at least with grep version 2.9. -- Best regards, Jörg-Volker.