Created
June 9, 2009 06:59
-
-
Save abbot/126323 to your computer and use it in GitHub Desktop.
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
import os, re, sys | |
r = re.compile(r'abc xyz = "(.*)"') | |
def matches(f): | |
return ['%s:%s' % (f, m.group(1)) for m in (r.match(l) for l in open(f, "r")) if m] | |
for fn in (fn for fn in os.listdir(len(sys.argv) > 1 and sys.argv[1] or '.') if os.path.isfile(fn)): | |
rc = matches(fn) | |
if rc: print "\n".join(rc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment