in reply to while loop hanging

$ cat yourfile | wc -l ; cat yourfile
If you are on a win32 system get cygwin or gnu power tools.