How to compare and merge a large number of text files?
February 8, 2013 12:22 PM Subscribe
How can I automatically compare and merge a large number of text files?
posted by incandescentman to computers & internet (41 answers total) 5 users marked this as a favorite
Due to a series of technical snafus with Dropbox and Simplenote syncing, my main writing folder, which contains text files mostly in Markdown format, is all messed up.
I have about 500 unique files, but now each of them has multiple versions. For any given file, the directory contains something like this:
They mostly have identical content - some contain extra line breaks at the beginning, or a line containing the file name.
I didn't realize immediately that this had happened and that I had multiple versions, though, so with for some of them, though, I've modified one of the versions and not others. (The good news is that when I modify files, I don't edit or delete, I just add new text.)
I want to reconcile my folder so that I have one canonical version for each file.
Since there are now thousands of files, and more than two versions of each one, I'd rather not use a manual diffs app to reconcile them.
Is there a tool that will find multiple text files containing the same content and automatically merge them? Again, the files contain duplicated content, with some new content, so simply merging the duplicated content and then adding the new content at the end of the file would be satisfactory.
(I'm using OSX 10.8.2 and I write primarily in Aquamacs Emacs. Oh, and I'm going to stop using Simplenote.)