Created
August 27, 2012 05:19
-
-
Save elprup/3485791 to your computer and use it in GitHub Desktop.
hadoop log viewer in Python
This file contains hidden or 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 re | |
mode = r'([A-Z_]*)="([^"]+)"' | |
vmode = r'\(([^)]+)\)\(([^)]+)\)\(([^)]+)\)' | |
filename = 's3.txt' | |
f = open(filename,'r') | |
lines = f.readlines() | |
jobinfo = lines[-1] | |
info = [] | |
for k,v in re.findall(mode, jobinfo): | |
for kk1, kk2, vv in re.findall(vmode, v): | |
info.append('%s,%s,%s' % (k, kk1,vv)) | |
for k in sorted(info): | |
print k | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment