Created
December 31, 2017 12:48
-
-
Save samduy/f290dcf15791d62d86b419354ab32d0d to your computer and use it in GitHub Desktop.
Read all files in folder and search for regex
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 glob, re | |
for msg in glob.glob('/tmp/*.txt'): | |
filer = open((msg),'r') | |
data = filer.read() | |
message = re.findall(r'<message>(.*?)>/message>', data, re.DOTALL) | |
print "File %s contains %s" % (str(msg), message) | |
filer.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment