V
V
Vladimir2014-11-17 08:54:41
PHP
Vladimir, 2014-11-17 08:54:41

How to get the difference of 2 csv files?

There is a need to compare 2 csv files. There is no sorting. The problem is, there are about 100,000,000 entries in the file.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rsa97, 2014-11-17
@azrail_dev

Well... I, being a lazy person, would make three scripts. The first is to read the source file by 100'000 records, sort and write to separate files. The second is to take two files, merge them with sorting into one, until one sorted file remains. The third is to read two already sorted files and output the difference between them.

A
anyd3v, 2014-11-17
@anyd3v

diff / vimdiff and similar

A
Anton Shamanov, 2014-11-17
@SilenceOfWinter

If we talk about abstract data, then I see nothing but bypassing the loop and comparing line by line. If you need to compare several different files with each other, then of course it would be nice to somehow sort / split them into block files first. The php.net/function.fgetcsv \ php.net/function.fputcsv
functions might come in handy .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question