Skip to content

Instantly share code, notes, and snippets.

@eloraburns
Created October 3, 2011 19:45
Show Gist options
  • Save eloraburns/1260031 to your computer and use it in GitHub Desktop.
Save eloraburns/1260031 to your computer and use it in GitHub Desktop.
Highlight the provided (regexp) arg in the output
#!/usr/bin/env python
import sys
import re
r = re.compile("(?P<subject>" + sys.argv[1] + ")")
for line in sys.stdin:
print r.sub("\x1B[1;32m\g<subject>\x1B[0m", line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment