Linux: grep -c "string" Very-large.file Win: find /C "string" File-name.txt Perl: perl -ne "$x++ if m/string/}{print qq|$x\n|" Large-file.txt (Change to single quote for Linux)