This iteration I am just trying to get it to let me specify the logs I want to parse from the command line (later I want to sort all this out and put it into a postgres database)
#!/usr/bin/python
###
import sys
import re
###
USAGE = (sys.argv[0]) + ''' logfile logfile logfile '''
###
def hasAccept(s):
return s.find('accept-n-log') != -1
def hasDrop(s):
return s.find('drop-n-log') != -1
def main():
if len(sys.argv) <= 1:
print USAGE
return 1
for logs in sys.argv[1:]:
open(logs)
for line in logs:
if hasAccept(line):
print(line)
if __name__ == '__main__':
main()
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor