winmerge icon indicating copy to clipboard operation
winmerge copied to clipboard

Suggestion - ignore first X characters on line when comparing text files

Open skyhirider opened this issue 2 years ago • 4 comments

Imagine two files, each containing a line file1 2023-06-14 message1 file2 2022-04-12 message1

WinMerge will tell me the lines are different, but what I would like to do is ignore the date (first 10 characters) and only compare the rest, so the result would be that the lines match.

Effectively, match text with regex and ignore if matches. I know there are filters in WinMerge now, but when I looked them up the result was that individual lines can't be parsed like that, WinMerge either ignores a line that matches a regex or does not.

skyhirider avatar Jun 14 '23 18:06 skyhirider

If you enter 1-10 in the argument of the IgnoreColumns plugin like below, the date part will be ignored.

image

sdottaka avatar Jun 14 '23 23:06 sdottaka

Thanks, does it work only for files with a txt extension? Applying it to a .log and it has no effect.

skyhirider avatar Jun 16 '23 09:06 skyhirider

It works even if the extension is .log as follows. Could you show me a screenshot?

image

sdottaka avatar Jun 16 '23 12:06 sdottaka

You were right, thanks sdottaka. I've tested it again and it indeed works.

What confused me was that when I selected one less character to ignore, the whole line was marked in yellow, instead of only the next starting with the first character that was not ignored.

On the screenshot you posted, if I selected 1-7 it would be less confusing if the first 7 characters, even if different, would be completely ignored and white. Would make it easier to spot differences as well.

Or maybe the ignored part could be highlighted in a different color, or potentially having an option to temporarily hide it. Would be great when working with files where the number of ignored columns is large.

skyhirider avatar Jun 19 '23 16:06 skyhirider