6

I have a few hundreds of HTML files whose contents are quite similar. I am looking for a GUI program for Windows that would allow me to define an area in the HTML (e.g. a table) that should differ across all HTML files.

E.g. given:

file1.html:

<table>hey<table>

file2.html:

<table>hey<table>

file3.html:

<table>hello<table>

The diff should show that file3.html contains something different in the table.

I know how to code it (e.g. Python + Beautiful Soup) but I wonder whether there is any existing program for that purpose.

5
  • You want to designate specific areas in the files to compare (e.g., this isn't whole-file-compare)? How would you designate those areas?
    – Ira Baxter
    Commented Aug 31, 2015 at 3:26
  • @IraBaxter E.g. selecting text in an HTML page, or element like in Chrome Developer Tools. Commented Aug 31, 2015 at 3:33
  • At a high level, what are you trying to accomplish? Do you only want to compare two files at a time, or compare a list of files against one file, or what? Do you want to compare the contents of the rendered web pages, or the HTML source?
    – Marsh
    Commented Sep 2, 2015 at 21:32
  • @MartinCarney I have downloaded a Web page every 30 seconds over a few days. The page contains a table, which sometimes change. I want to detect such changes. Commented Sep 2, 2015 at 21:37
  • So you're more interested in the data in the table than the html markup. If the given answers don't solve it for you, you'd probably be best to code something up. There are plenty of libraries for reading html/xml in most every programming language, so you just need to drill down to the table and pull out the data, then compare it.
    – Marsh
    Commented Sep 2, 2015 at 21:42

2 Answers 2

3

I'm a fan of the diff tool Meld for this kind of thing. It lets you compare up to 3 files at a time, as requested, but will also compare entire directories if needed.

Just a few features from their home page:

  • Two- and three-way comparison of files and directories
  • File comparisons update as you type
  • Auto-merge mode and actions on change blocks help make merges easier
  • Visualisations make it easier to compare your files
  • Supports Git, Bazaar, Mercurial, Subversion, etc.

Here's a small image from the Meld site for the diff ability which shows blocks of differences, or a small change on one line:

enter image description here

It runs on Windows, has packages for most Linux distributions and even has a Mac version, so you can change environments if you like.

2

Try Beyond Compare. It is very flexible, it supports many many formats and will now compare 3 files.

You can alias a section from one file to one in another file even when the automatic scanner rejects the similarity. That is, you can force it to diff the sections you want to compare.

Text files can be viewed and edited with syntax highlighting and comparison rules tweaked specifically for documents, source code, and HTML.

1
  • 2
    Can you please edit your answer and include how Beyond Compare meets the requirement of "would allow me to define an area in the HTML (e.g. a table) that should be diffed across all HTML files"?
    – Izzy
    Commented Aug 31, 2015 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.