Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Visually compare text by dragging Apps
I often want to compare two blocks of text, such as the output of various Terminal commands, the CLI configs of a pair of devices such as routers, switches, or firewalls, and also file checksums.

I've found that one very easy way to do this with smaller blocks of text is to simply highlight one of the blocks of text and then drag it on top of the other block (sometimes it's necessary to click and hold on the text for a moment before dragging it). Since the dragged-over text is displayed in a semi-transparent way, when it's aligned correctly over the other block of text it's quite obvious where any differences are. Once the visual comparison is complete I just hit the Escape key to cancel the drag & drop operation, though this isn't necessary if the destination app in question doesn't accept drag & drop text input.

Obviously the fonts should be the same and the same size for this to work the best, but that's usually the case in the Terminal and with most my TextEdit docs, or within a single app such as a Safari or Firefox web page. It's also most useful for small blocks of text that are completely visible all at the same time, since scrolling the dragged text isn't possible in mid-drag as far as I can tell. For larger comparisons I still use FileMerge, but for small quick comparisons this works well for me, and it seems to work in most apps.

[crarko adds: I tested this using TextEdit, and it works as described. It's somewhat more difficult to do using a trackpad.]
  • Currently 2.74 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (35 votes cast)

Visually compare text by dragging | 9 comments | Create New Account
Click here to return to the 'Visually compare text by dragging' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Visually compare text by dragging
Authored by: Satinder S Sidhu on Jul 07, '10 07:48:42AM
I suggest the name SeeDiff for this technique!

[ Reply to This | # ]
Visually compare text by dragging
Authored by: robleach on Jul 07, '10 07:52:13AM

Of course! Why didn't I think of that?! That's a really cool tip. I will be using it!

One other note that wasn't mentioned... you'll also have to be sure that the window size is the same in the second window if your text wraps to the next line. Also, you can drop the text on the finder's menu bar without anything happening. And as far as I know, you always have to click-and-hold to drag any highlighted text.

Other things non-text wranglers may not know: you can select an entire line with a triple-click, holding down the option key will copy the text to the drop point (otherwise it should be cut & paste, but my experience shows this isn't universal), double-click & drag highlights whole words at a time, you can use the function keys to change apps (etc) while dragging, and dropping on the desktop creates a text clipping.

[ Reply to This | # ]
Visually compare text by dragging
Authored by: osxpounder on Jul 09, '10 01:12:41PM

Great to know!

I just tried these in TextEdit on Snow Leopard 10.6.4, and I find triple-clicks do not select an entire line in a plain (or rich text) text file. Instead, they select the entire paragraph.

[ Reply to This | # ]
Visually compare text by dragging
Authored by: craigsheppard on Jul 07, '10 09:10:54AM

Great tip! I've been doing something similar for a while - two terminal windows with transparency, but your hint applies to any text :)

[ Reply to This | # ]
Visually compare text by dragging
Authored by: Andrew J Freyer on Jul 07, '10 09:52:29AM

I rather like this hint - something I'd never thought of on my own, but on it is own excellently simple and powerful.

Easier location-based computing: with Airport Location, app for 10.6. It's an early Beta, so please report bugs!

[ Reply to This | # ]
Visually compare text by dragging
Authored by: philostein on Jul 07, '10 02:20:13PM
On a similar note, text can be compared for equality by hitting ⌘E (Use Selection for Find) with some selected text, moving to another window, and hitting ⌘G (Find Next). Equal text will be highlighted in different apps, windows and with different font sizes.

Quicker than dragging, but it won't show where any differences are in unequal text. I'll definitely be using djdawson's tip also.

[ Reply to This | # ]
Visually compare text by dragging
Authored by: ebooth on Jul 08, '10 07:57:09AM

A better solution is to download Text Wrangler (free, and use the "Find Differences" tool which will highlight similarities and differences in the two documents/folders/blocks of text line by line and easily apply changes across the text. I use this program to compare older and newer versions of code for changes (intentional or not).

[ Reply to This | # ]
FileMerge for larger files
Authored by: scooby509 on Jul 09, '10 11:49:49AM

That's a pretty good idea for shorter runs of text.

If you've got Developer tools installed, try FileMerge for comparing larger files, or even folders of files. At each difference, you simply pick the side you prefer, and then save the resulting merge.

[ Reply to This | # ]
Visually compare text by dragging
Authored by: fulmar2 on Jul 09, '10 01:55:11PM

This is the best kind of hint... so simple, but so useful!

[ Reply to This | # ]