How to modify the secind line of file

HI))
I have a cycle, in wich I have to modify the second line of file in
every iteration of cycle)

Is there that kind of stuff in ruby??))

how can I change the offset in file?? for example in C it is lseek())