<s> import os <EOL> import re <EOL> import time <EOL> import sys <EOL> def saveFile ( log ) : <EOL> file = open ( "<STR_LIT>" , "<STR_LIT:w>" ) <EOL> for line in log : <EOL> file . write ( line ) <EOL> file . write ( "<STR_LIT:\n>" ) <EOL> file . close ( ) <EOL> return <EOL> def openFile ( Filename ) : <EOL> f = open ( Filename , "<STR_LIT:r>" ) <EOL> print "<STR_LIT>" + Filename <EOL> log = [ ] <EOL> noOfLines = <NUM_LIT:0> <EOL> for line in f : <EOL> if "<STR_LIT:root>" and "<STR_LIT>" and "<STR_LIT>" in line : <EOL> continue <EOL> elif "<STR_LIT>" and "<STR_LIT>" and "<STR_LIT>" in line : <EOL> continue <EOL> else : <EOL> line = re . sub ( '<STR_LIT>' , '<STR_LIT>' , line ) <EOL> log . append ( line ) <EOL> print "<STR_LIT>" <EOL> f . close ( ) <EOL> return log <EOL> start = time . time ( ) <EOL> directory = os . path . join ( "<STR_LIT>" , "<STR_LIT:path>" ) <EOL> f1 = str ( sys . argv [ <NUM_LIT:0> ] ) <EOL> f2 = str ( sys . argv [ <NUM_LIT:1> ] ) <EOL> log1 = [ ] <EOL> log2 = [ ] <EOL> log1 = openFile ( f1 ) <EOL> log2 = openFile ( f2 ) <EOL> logSimilar = [ ] <EOL> log1difference = <NUM_LIT:0> <EOL> noOfSimilarities = <NUM_LIT:0> <EOL> print "<STR_LIT>" <EOL> for line in log1 : <EOL> if line in log2 : <EOL> logSimilar . append ( line ) <EOL> noOfSimilarities = noOfSimilarities + <NUM_LIT:1> <EOL> print line <EOL> saveFile ( logSimilar ) <EOL> end = time . time ( ) <EOL> timeTaken = end - start <EOL> print "<STR_LIT>" , timeTaken </s>
