Created
October 31, 2012 21:38
-
-
Save brianly/3990064 to your computer and use it in GitHub Desktop.
Finds lines in the Syncie Log page. Copy the Syncie page to a text file first, obviously.
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/python | |
import re | |
import argparse | |
import locale | |
# Accept a sane looking network ID | |
parser = argparse.ArgumentParser(description='Syncie Log Parser') | |
parser.add_argument('-n', action="store", dest="network", type=int) | |
args = parser.parse_args() | |
# Format the network ID with commas | |
locale.setlocale(locale.LC_ALL, 'en_US') | |
euro_id = locale.format("%d", args.network, grouping=True) | |
# Do stuff | |
if args > 0: | |
rg = re.compile('%s\W' % (euro_id), re.IGNORECASE | re.DOTALL) | |
for line in open('/Users/blyttle/junk/syncielog.txt'): | |
m = rg.search(line) | |
if m: | |
print line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment