tags:

views:

10

answers:

1

Hi all,

I have a server log file which is constantly updated. after some script execution, I want to collect the relevant part of my execution from the server log into an execution log.

Basically, I need to capture the last line number of my server log before the test started (which I already know how to do), say X, and after execution, copy the lines from X to the new end of server log, now, X+1000.

How do I copy only lines X to X+1000?

Thanks, Assaf

+1  A: 

Try this

open("execution.log", "w").write("\n".join(open("server.log").readlines()[X:X+1000]))
jcubic