Для Linux / Unix:
wc -l filename
Для Windows:
find /c /v "A String that is extremely unlikely to occur" filename