6

I have several log files with content like this:

2022-03-13 21:16:46.367972: I This is a test1

Is there a way to tell the WinMerge to exclude date/time comparison without removing a timestamp with a RegEx?

These logs come from a program that produces logs. I have to find differences between messages in 2 files, ignoring timestamps.

Giacomo1968
  • 58,727
Andrey
  • 180

3 Answers3

3

WinMerge has various "PreDiffer" plugins that you can configure and enable - in this case, it might be simplest to have it ignore the values in a range of columns where the date/time-stamps exist in both files, assuming they are placed in common columns for both files.

Plugins -> Plugin Settings -> ignoreColumns.dll -> range of column numbers with timestamps to not include in comparisons

Then, make sure you enable this plugin by selecting:

Plugins -> Prediffer -> ignoreColumns.dll

Ξένη Γήινος
  • 3,902
  • 13
  • 45
  • 84
wader
  • 31
2

Apparently it's possible with a custom plugin. WinMerge has several custom made plugins in C:\Program Files\WinMerge\MergePlugins. One of them is called "PrediffLineFilter.sct" that is intended to exclude some part of a line before comparison. But for some reason it didn't work for me.

Instead, I switched to Beyond Compare. It has a feature called "Unimpotrant text".

Below is a "How To":

  1. In text comparison mode enter "Rules"
  2. Add a new "Unimportant text"
  3. Add a text to exclude.
    In my case, to exclude log timestamp, I used "\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d.\d\d\d\d\d\d"
  4. If you use RegEx, check a proper checkbox
  5. If you want to see only differences, press "Diffs" button
  6. If you want to exclude "Unimportant text" from differences, press "Minor" button

enter image description here

Andrey
  • 180
1

You can use filter now

You can setup a regex filter like in the picture with

  • \[\d{2}:\d{2}:\d{2}\.\d{3}\] for date like
  • [11:55:27.519]

Filter config:

Filter config

Greenonline
  • 2,390
Axel
  • 11
  • 2