T
Tristan Knowles
How would I use File or IO to read all the lines of a
file, then display the contents in reverse?
Its for a simple log reading script, which I would
like to have read the total lines, then display with
the latest entries first, and show x amount of log
entries per page.
I'm currently just dumping the whole, or part of the
log with:
=3D=3D=3D=3D=3D=3D
IO.readlines("my.log")[1..49].each_with_index do
|line, index|
=3D=3D=3D=3D=3D=3D
I guess I would have to count all lines, then assign a
variable to the last number it counts, and then work
in reverse from this variable... hmmm. I'm not
sure
Any ideas?
=09
___________________________________________________________=20
How much free photo storage do you get? Store your holiday=20
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
file, then display the contents in reverse?
Its for a simple log reading script, which I would
like to have read the total lines, then display with
the latest entries first, and show x amount of log
entries per page.
I'm currently just dumping the whole, or part of the
log with:
=3D=3D=3D=3D=3D=3D
IO.readlines("my.log")[1..49].each_with_index do
|line, index|
=3D=3D=3D=3D=3D=3D
I guess I would have to count all lines, then assign a
variable to the last number it counts, and then work
in reverse from this variable... hmmm. I'm not
sure
Any ideas?
=09
___________________________________________________________=20
How much free photo storage do you get? Store your holiday=20
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com