Skip to content

Instantly share code, notes, and snippets.

@saml
Created April 26, 2013 20:00
Show Gist options
  • Save saml/5470061 to your computer and use it in GitHub Desktop.
Save saml/5470061 to your computer and use it in GitHub Desktop.
import sys
import re
import fileinput
LogRE = re.compile(r'^(\S+) (\S+) (\S+) (\S+ -0400) ("[^"]+") (\S+) (\S+) ')
if __name__ == '__main__':
lines = fileinput.input() if len(sys.argv) < 2 else fileinput.input(sys.argv[1])
for line in lines:
m = LogRE.match(line)
print('%s %s %s [%s] %s %s %s' % m.groups())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment