November 6th, 2012, 04:53 PM
Search file for text and print the first four characters to the right.
I am attempting to search log files and print the duration on each line that lists a duration.
So, if the line looks like this:
It will print an int:
Here's what I have so far:
Thanks in advance for any help.
for files in glob.glob("*.log"):
for line in open(files):
if ": duration: " in line:
print line # just print value beside "duration"
November 6th, 2012, 07:10 PM
line.split(": duration: ")[:4]
[/code] are essential for python code and Makefiles!