> How to get the total number of lines of a text file
Read it completely and count either "\n", "\r\n" or "\r" depending on the
platform the text-file was constructed.
Thomas Kellerer - 12 Jun 2005 18:18 GMT
Skip wrote on 12.06.2005 19:16:
>>How to get the total number of lines of a text file
>
> Read it completely and count either "\n", "\r\n" or "\r" depending on the
> platform the text-file was constructed.
If you use a BufferedReader then it will take care of the line endings
automatically.
Thomas
> How to get the total number of lines of a text file
1. wc -l ./filename
...or...
2. count the number of readLines in a BufferedReader
> How to get the total number of lines of a text file
wc -l
Harald.

Signature
---------------------+---------------------------------------------
Harald Kirsch (@home)|
Java Text Crunching: http://www.ebi.ac.uk/Rebholz-srv/whatizit/software