0

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
  • 1
    before asking this question here, what attempts have you made? What problems did you have?
    – aborruso
    Commented Sep 13, 2023 at 6:26

1 Answer 1

1

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))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .