TechHui

Hawaiʻi's Technology Community

Do you have a preferred program or method for comparing two text files?

Does anyone out there have a preferred program or method they can recommend for comparing two text files?

I have a couple versions of code for the same web page and I'm trying to pinpoint exactly what was changed. Google has given me mixed results and I'm just wondering if there might actually be some killer app or online tool out there that I've never heard of.

Thanks!

Views: 92

Reply to This

Replies to This Discussion

diff?
Loren, I suspect what you're looking for is a "semantic diff" or a "tree diff". This will be specific to the type of text file you're looking at. "diff" (the unix utility) will compare two text files, but can't compete with tree-based diffs that take a grammar as input. Unfortunately, I don't use anything like that on a regular basis. This post could be the beginning of a good thread, though.
They don't compete - they are merely different.
Do you want to know the semantic difference between two structured content (e.g. XML) files or the actual character/line-level difference? If you are writing a grammar parser for example, you may want both.. i.e. to validate that two files are semantically identical but structurally different.

If you are just looking at "two text files" (or pretty much any regular code) from the same heritage.. and one has a bug/feature and one doesn't - regular ol' diff is just fine. Any half-decent IDE/editor (Visual Studio, emacs, Eclipse, vim, etc) does this and many implement semantic comparison also since they need to understand what you're trying to do. That's how tools like ReSharper are able to suggest you rewrite/substitute code, collapse import lines, etc - all they're doing is realizing "hey I can find a neater way to rewrite this that is semantically equivalent". l believe Eclipse has a similar tool for Java, Dan would probably know more on this.
I've used BBEdit (Mac only). It shows both side by side and which lines are actually different.

The tool I use is BeyondCompare which is a paid version but worth it if you are doing code development.

 

Reply to Discussion

RSS

Sponsors

web design, web development, localization

© 2020   Created by Daniel Leuck.   Powered by

Badges  |  Report an Issue  |  Terms of Service