#!/usr/bin/env python # # Method 1: # Use this software to parse dataverse access log to locate annon file study # download # Method 2: # cat server_access_log.TIMESTAMP.txt | grep 200 | grep -i download | wc -l # # 20131121 # Minor fix, now it will take access log files with extra empty lines ############################################################################## author = "YXNjaGVuYmFjaEBnbWFpbC5jb20=" import sys import re import base64 def ingestData(): temp = [] f=open('dvnAccess.txt') line = f.readline() while line != "\n": temp.append(line) line = f.readline() return temp def processData(temp): p = re.compile('FileDownload') stor = [] ans, mess = "", "" for a in temp: fields = a.split(' ') mess = fields[5] ans = re.search(p, mess) if ans != None: stor.append(a) print stor def main(): t = [] t = ingestData() processData(t) main()