Last active
October 19, 2016 13:46
-
-
Save henkjanverkerk/e8a1122a697ee44105ecce091f13ed9c to your computer and use it in GitHub Desktop.
Simple merger for flat files
This file contains hidden or 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
# Needed this for merging a couple of log files into one file under conditions: | |
# - only files of type .log needed to be merged | |
# - only line starting with 'RLS' needed to be merged | |
import os | |
g = open('total.txt','a') | |
for file in os.listdir('.'): | |
if file.endswith('.log'): | |
f = open(file,'r') | |
for line in f: | |
if line.startswith('RLS'): | |
g.write(line) | |
f.close() | |
g.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment