I have a CSV file named CSV1 with over 5000 rows and 3 columns - last name, first name and email address. I have another file named CSV2 with about 2700 rows with the same 3 columns. I have to remove the entries that are in CSV2 from CSV1. How do I do this? Please help:)
1 Answer
Using python might be an easy way to do this. If you can use python, you can try:
entries = []
entries2 = []
with open('CSV2.csv', 'r') as my_file:
for line in my_file:
columns = line.strip().split(',')
if columns not in entries:
entries.append(columns)
with open('CSV1.csv', 'r') as my_file:
for line in my_file:
columns = line.strip().split(',')
if columns not in entries:
entries2.append(columns)
with open('CSVnodup.csv', 'w') as out_file:
for i in entries2:
out_file.write(','.join(i))