Compare files, ignore certain lines

When comparing two documents one finds the differences and makes a conclusion. What if there are differences that are not significant for the comparison? For example:

  • Developer’s comments in the source code are important, but they don’t affect code execution.
  • Different date and time stamps in the end of each page will be highlighted as a difference, but they are not an important part of the document content.
  • Some words that are synonymic for the human eye will be highlighted as being different.

With Compare Suite PRO users can manage  these situations by specifying proper settings for ignoring certain items.

Ignoring in Compare Suite

To access “Ignoring” settings in Compare Suite go to the Tools > Options > Ignoring.

Line ignoring settings in Compare Suite

Let’s review shortly the options available there:

  • Line ignoring. The first text box is for the strings that need to be ignored. For example, record “Date time * {0}” in this list will tell Compare Suite that the line that contains “Date time” need to be ignored. Parameter between { and } shows if user wants to ignore the line where the mentioned “Date time” marker was found (in this case we use {0}), or for example, the next line (in this case we’d use {1}).
  • Words ignoring. The next text box is for the words that will be ignored. What does it mean? If for example in the left document you have “company” and in the right file you have “corporation,” then you can add “company” word (or “corporation” word) into word ignore list and Compare Suite won’t mark the difference as a difference.
  • Ignore comments. The next check box is “Ignore comments in source files (C++, C#, PHP, Java, Delphi).” It does what it says. It will be able to ignore commented lines (the text after // ) as well as commented blocks (the program recognizes blocks of  /* … */ in C++ files and  { … } in .pas files). Function will work only if you compare files with original extensions (e.g. .cpp or .pas).

Ignoring date and time stamps

As  was mentioned before, this feature helps to ignore lines that are not important for the comparison. For example, each page of your document might include date and time information about when this document was created.

It is obvious, that two documents will have different creation times and it doesn’t make any sense to show those differences and distract a user’s attention from more important differences. The solution is to determine some repeating pattern and ignore it.

For example, your document might look like:

Line 1

Line 2

Line 3

Author: Bob

Modified:

2nd September, 2014 12:31:34

Line 1 – 3 is where the key information is. A document might be edited by different authors and for sure will have different modification time. You might want to ignore these changes and focus on Line 1 – 3. To do this go to the ignoring options and add there:

  • Author: * {0} (in this way we tell Compare Suite to ignore line that starts with Author:)
  • Modified: * {1} (in this way we tell Compare Suite to ignore the 1st line that goes after “Modified:”

Ignored line with date and time stamp

Ignoring words

Application of this feature is not that obvious but sometimes it really helps to deal with synonymic names. For example, you can add in the list “company,” and “firm.” In this Case Compare Suite won’t mark the between this two sentences:

  • Our client is a company from the US
  • Our client is a firm from the US

Probably, this is a feature that legal specialists will never use. At the same time, those who needs to filter quickly unimportant changes, will find it really useful.

Ignored word

There is a trick: switch your comparison to the “By keywords” mode. You’ll see that Compare Suite supports word ignoring during “By keywords” comparison as well. In this way you might be having more accurate statistics about the differences.

Ignoring developer’s comments in C++, C#, PHP, Java, Delphi files

The mentioned check box does what it name says – it will ignore comments in the source code. Good thing is that it can handle comments of one line (software developers normally use // for this purpose), and it can ignore the whole blocks of comments like (/* … */ in C++ and similar, or {…} in Pascal).

For example, these two lines:

  • a=b*c; // getting a value
  • a=b*c; // calculating a value

Line and block comments ignored

will be shown as equal, as Compare Suite will ignore the text in the comments. The same applies to the blocks of comments.

  • This ignoring feature together with syntax highlighting makes Compare Suite a must-have tool for the comparison of source codes.

Only important changes are highlighted

One important note: Compare Suite detects file format by the file extension. So, if you will save your .pas file into .txt file, then Compare Suite won’t be able to process it as Pascal source code file. Keep an original extension and everything will work perfectly!

Ignored lines in the report

A good question is, “How do I know about the lines that were ignored?” Compare Suite ignores the lines, but still one might need to review the lines that were ignored.

Compare Suite uses a yellow color for the ignored lines. It will mark with yellow the text that was ignored text both in program interface and in the reports.

How our customers used line ignoring

Here are some examples of how our customers applied ignoring feature.

We are using the features of Comparing Folders, Ignore Line option (not ignore by keywords), XML Comparing (XML is not Sorted but Compare Suite sorts it before comparing) and using command line calls. Let’s review these features in the details and give some specific examples. Read more…

Paul Geraci, Analyst Programmer, Friends First Holdings Ltd, Ireland

The comparison options are highly configurable. For example, you can set up a list of keywords that will be ignored during the file comparison or you can configure the fonts and colors used to highlight added, deleted or modified words or files.  Read more…

Anthony Frend, Scientific Support Analyst, HLS, Huntingdon, UK

 Do you have any questions or your own case to share? Feel free to share it via comments.


Leave a Reply

Compare Suite Video Introduction
Download free 30-day trial version.

Where Compare Suite is used:

Compare Suite Features:

Compare FileCompare documents to find differences regardless of the format: MS Word, MS Excel, MS PowerPoint, PDF.

Compare FoldersCompare two local or remote folders to find and synchronize any changes made.

Compare by KeywordsUse the keywords comparison to analyze non-related documents created from different formats.

Compare ArchiveArchive comparison: compare Rar and Zip archive files without unpacking / unzipping.

COmpare Web-PageCompare web pages as code with HTML tags or as text as seen in a web browser.

Compare ImagesCompare two images of various formats to find all possible differences, even slight ones.

Compare MultimediaMultimedia comparison. Compare information from multimedia and graphic formats.

Ignore WordsIgnore words. Compare Suite can ignore certain keywords or strings during comparison.

Integrate with DMSDMS Integration. Easily integrate Compare Suite into 3rd party document management systems.

Highlight SyntaxSyntax highlighting for .pas, .asm., cpp, PHP, XML, bat, css, dpk, xsl files supported.

Compare FTPCompare files located on FTP as easily as on hard drives or local area networks.

Compare Command LineUse command line to automate comparisons and integrate it with 3rd party tools.

Compare UnicodeUNICODE is fully supported: open and compare documents in any language or encoding.


Review compared documents:

Compare ReportCreate a fully customizable comparison report on two files or folders.

Compare CommentsWrite your own comments on changes you or your colleagues make, improving collaboration.

Audit DocumentUse document audit to accept or decline changes made in plain text files.

What is Compare Suite?

  • It is a file compare tool
  • In office Compare Suite helps to compare word files, Excel spreadsheets, web-pages
  • Software developers and web-masters use Compare Suite to do version compare, approve changes in documents or compare certain file types like XML, PHP, C-Sharp
  • Office managers use Compare Suite to diff PDF files, compare invoice files
  • Compare Suite also make it much easier synchronization of directories