Need an App or Script to Parse Diffs in Different Text Versions
June 26, 2016 10:09 AM   Subscribe

I'm on a project where I frequently need to compare two versions of bits of text (< 100 words) to find changes. I'd love an app or script where I can quickly paste version 1, then version 2, and be shown the changes, ideally in editor's markup (even better if it can ignore spacing/styling diffs). Sleek workflow (i.e. minimal # of actions) is essential. I'm on a Mac, but happy to use Terminal (especially if I can script the process). Any suggestions? Or should this be a MetaFilter Jobs proposal?

1. BBedit is too cumbersome, because you must save each version to its own doc and then select each doc for comparison.

2. No, we can't install a versioning system for the project as a whole. Without going into boring details, I'm absolutely stuck with parsing diffs blindly after the fact.
posted by Quisp Lover to Computers & Internet (17 answers total) 4 users marked this as a favorite
Response by poster: Something like this, but with better markup of results (i.e., I don't just want diffs, I want to know specifically what's been added/subtracted between version 1 and version 2).
posted by Quisp Lover at 10:13 AM on June 26, 2016

Response by poster: This is very close (if you choose "markup 2")
posted by Quisp Lover at 10:23 AM on June 26, 2016

Sublimerge, for Sublime Text might fit what you want.

Copy text 1, paste in new-document tab
Copy text 2
Right-click and hit (Compare with clipboard) (There's probably a keyboard shortcut here as well)
There you go.
posted by CrystalDave at 11:02 AM on June 26, 2016

Beyond Compare has a text-comparison mode that lets you paste two different files into tabs and show differences with very fine control. Its a great tool, I use it on a Mac every day.
posted by paulash at 11:03 AM on June 26, 2016 [3 favorites]

If you have XCode installed on your Mac, it comes (I think that's where it comes from, at least) with an application called FileMerge (screenshot link, which explains how it works pretty well). It's meant for code, but it should work on any text document.
posted by destructive cactus at 11:43 AM on June 26, 2016

I use Kaleidoscope for things like this.
posted by melorama at 11:44 AM on June 26, 2016

Does MacOS come with sdiff? It's a standard Unix command.
posted by Chocolate Pickle at 12:00 PM on June 26, 2016

Yes, OSX comes with sdiff. For a graphical view, the split-diff package for Atom works well.
posted by bradf at 12:40 PM on June 26, 2016

Seconding Beyond Compare.
posted by RolandOfEld at 1:28 PM on June 26, 2016

Response by poster: Beyond Compare's "text compare" seems to be two ultra skinny little fields to paste into, neither wrapped in any way, with a skinny little unwrapped display below. The rest of the window is completely wasted while I struggle to make sense of the tiny unwrapped ribbon-like fields, wondering why the devs would persecute me in this way.

This is either a laughable nightmare, or else I'm missing some sanity adjustment that should be the default.
posted by Quisp Lover at 1:41 PM on June 26, 2016

This might be a stupid question, but: Why not just use the online diff you said you like?

If you're not comfortable/able to upload your text, it would be straightforward to create a local copy for yourself, as it appears to be pure client-side javascript. The original project is jsdifflib. Download the html, js and css files into a folder (duplicate the very simple folder structure they've got), point your browser at the html file, and go.

I can explain in more detail if it would be useful for you.
posted by clawsoon at 2:30 PM on June 26, 2016

BBEdit in fact doesn't require you to save each doc before comparing. Just yesterday I pasted two AppleScripts into separate new documents, compared them and then closed them without saving. The current open documents are listed in the dropdown where you select the docs to compare.
posted by roosterboy at 3:09 PM on June 26, 2016

Filemerge is nice and free; I think it's now inside the Xcode app bundle, tho.
posted by jabah at 5:37 PM on June 26, 2016

A minor correction to my earlier answer: The online tool you linked to doesn't upload any data, so the only reasons you'd need to make a local copy would be if you wanted to a) work completely offline, i.e. you don't even have an Internet link when you start work for the day or b) make modifications to things like textarea size and placement, automatically defaulting to "markup 2", setting it to update live as soon as you cut and paste, changing the fonts, etc.
posted by clawsoon at 5:56 PM on June 26, 2016

I don't have software suggestions but the reference to styling and spacing differences makes me think these are not text files in the software developer sense, but text documents of some kind. In which case line by line "Unix diff" comparisons would indeed be unhelpful, but to make good recommendations we'd need to know more about your workflow (software, etc.)
posted by doiheartwentyone at 4:31 AM on June 27, 2016

Failing that, copy and paste out of your app will probably drop formatting in a sane way, so clawsoon's suggestion sounds good.
posted by doiheartwentyone at 4:34 AM on June 27, 2016

Response by poster: Clawsoon: My second reply to myself contained a link that I hadn't known about when I first posted. As I say, it's very close to what I need, but I was hoping for something a bit more refined and configurable (e.g. stipulate capitalization and white space exclusions, etc).

Online is fine; I don't need local.

doiheartwentyone: I don't want to work with text files, just snippets of copy/pasted text, largely unformatted. If I were comparing text files, BBedit would work well for this purpose.
posted by Quisp Lover at 10:02 AM on June 27, 2016 [1 favorite]

« Older Tell me why it's gross/disgusting to eat someone...   |   Adorable animals to follow on Snapchat 🐾 Newer »
This thread is closed to new comments.