How to pull the last line from a file

cobra

Client
Регистрация
06.09.2011
Сообщения
11
Благодарностей
0
Баллы
0
We all know how to pull the first, second, third ... line form a file, but is it possible to pull the last line from a file?
 

gcomm

Client
Регистрация
01.03.2011
Сообщения
332
Благодарностей
93
Баллы
28

cobra

Client
Регистрация
06.09.2011
Сообщения
11
Благодарностей
0
Баллы
0
Thanks gcomm, that worked like a charm :-)
 

czajnis

Новичок
Регистрация
11.02.2012
Сообщения
2
Благодарностей
0
Баллы
0

drvosjeca

Client
Регистрация
26.10.2011
Сообщения
512
Благодарностей
455
Баллы
63
when you count number of strings you get the real number (1,2,3,4,5...), but when you wana decide which one you wanna pull...well, zenno starts its count from 0.

That is why you need to use -1, because in this case zenno will do count to 10 like this...: 0,1,2,3,4,5,6,7,8,9 --> you see that is 10 numbers. So now if you have 10 lines and you wana call last one, you are calling line number 9. <--so i hope now you understand why -1 is needed ;-)
 

lukas76

Client
Регистрация
14.04.2012
Сообщения
48
Благодарностей
10
Баллы
8
This is sexy thanks guys! :-)
 

Здраво

Client
Регистрация
11.07.2011
Сообщения
99
Благодарностей
45
Баллы
18

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)