Created
December 17, 2018 15:10
-
-
Save kieranjol/2f5584150b7773cab82724ded07293ca to your computer and use it in GitHub Desktop.
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
#usr/bin/env python | |
''' | |
Loop/iterate through all files within subfolders: | |
find the SIP log file | |
how to process each line in a textfile | |
find the line in the log file that contains the reference number | |
extract just the value | |
print a list of values | |
maybe find some way to insert into the OE register | |
''' | |
import os | |
import sys | |
source_dir = sys.argv[1] | |
query = sys.argv[2] | |
for root, dirnames, filenames in sorted(os.walk(source_dir)): | |
for filename in filenames: | |
if filename.endswith('_sip_log.log'): | |
full_path = os.path.join(root, filename) | |
with open(full_path) as logfile: | |
for line in logfile: | |
if query in line: | |
print(full_path) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment