Skip to content

Instantly share code, notes, and snippets.

@inky
Created January 2, 2012 03:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inky/1549143 to your computer and use it in GitHub Desktop.
Save inky/1549143 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import re
import sys
# 00:00:00 < user> optional_prefix: TEXT TO KEEP
content = re.compile('^[0-9]{2}(:[0-9]{2})+ <[^>]+> ([^\s]+:\s)?(.*)$')
for line in sys.stdin:
result = content.search(line)
try:
line = result.group(3).strip()
except AttributeError:
continue
if line:
print ' '.join(line.split()).strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment