Created
August 6, 2014 14:59
-
-
Save mbarton/941740f82a7b2f2582b1 to your computer and use it in GitHub Desktop.
Make all logs in this directory readable
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
#!/usr/bin/python | |
import glob | |
for log in glob.glob("**/*.log"): | |
f = open(log, "r") | |
mod_lines = [] | |
for line in f: | |
split_line = line.split(" ") | |
mod_lines.append("%s %s %s" % (split_line[0], split_line[1], " ".join(split_line[4:]))) | |
f.close() | |
f = open(log, "w") | |
for line in mod_lines: | |
f.write(line) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment