You have been given three good answers, but I especially support Davido's recommendation to use the "$." variable (line count in the file being read) rather than counting yourself the line number. It is simpler, easier and probably faster.
In reply to Re: Question on Reading a file inside while and counting no.of lines
by Laurent_R
in thread Question on Reading a file inside while and counting no.of lines
by vyeddula
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |