im working on a comparasion of csv file. The problem is that the files have different structure and the comparation work bad.. can anyone help me? Thank you.
import csv f1 = file('Report.csv', 'r') #hosts f2 = file('p.csv', 'r') #master log file f3 = file('results.csv', 'w') c1 = csv.reader(f1) c2 = csv.reader(f2) # c3 = csv.writer(f3) masterlist = list(c2) for hosts_row in c1: row = 1 found = False for master_row in masterlist: results_row = hosts_row if (hosts_row[1]).split(',') == master_row[1]: results_row.append('FOUND in log file (row ' + str(row) + ')') found = True break row = row + 1 if not found: results_row.append('NOT FOUND in log file') c3.writerow(results_row) f1.close() f2.close() f3.close()p.csv
MrLog - PortScan Analysis results Date 13 Dec 14 IP xxx.xxx.xx.xxx IP start port end port xxx.xxx.xx.xxx 5161 5165 xxx.xxx.xx.xxx 5061 5069report.csv
ipv vvv.vvv.vvv mach1 xxx.xxx.xxx port xxxxx xxx xxx mach2 xxx.xxx.xxx port xxx xxx xxxx