Re: counting lines
Re: counting lines
- Subject: Re: counting lines
- From: Shane Stanley <email@hidden>
- Date: Fri, 13 Jul 2001 08:40:50 +1000
On 13/7/01 5:07 AM +1000, Arthur Cormack, email@hidden, wrote:
>
I am writing a script that uses bbEdit to open up a log file, and
>
change the date formats of every entry in that log file. I am having
>
a problem counting the number of lines in the logfile. The line that
>
I use to calculate the number of lines goes like this:
>
"set lineCount to the number of lines in text window 1"
>
And it always seems to return a number that is 1 less that the number
>
of lines.
>
-I have noticed, however, that If I manually add a hard return after
>
the last line (there wasn't one there before) then it works.
>
Is there another perhaps another term that I should be using to
>
calculate the number of lines in a text file?
I think you're doing the right thing; it looks like a bug to me. If you
have, say, five lines, count will return 4 but "line 5" and "line -1" both
return the last line.
--
Shane Stanley, email@hidden