Created
September 29, 2013 22:08
-
-
Save fillest/d93920f628a2513c81a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
import datetime | |
import time | |
r = re.compile(r'\[([\.\d]+)\].+\[(\d+/\w+/\d+:\d+:\d+:\d+ \+0400)\].+Mistress') | |
with open(sys.argv[1]) as f: | |
for line in f: | |
line = line.strip() | |
m = r.match(line) | |
if m: | |
d = datetime.datetime.strptime(m.group(2), "%d/%b/%Y:%H:%M:%S +0400") | |
# print m.group(1), m.group(2), d, time.mktime(d.timetuple()) | |
d += datetime.timedelta(hours = 4) | |
v = float(m.group(1)) | |
if v > 5: | |
v = 5 | |
print time.mktime(d.timetuple()), v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment