Thursday, March 31, 2011

Compare tool that can mask differences?

I do a lot of file comparisons (source, logs etc.) and need to mask certain sections e.g. dates / times / line numbers which cause every line to be different.

Beyond Compare allows you to pre-process the files but then you have to write pieces of code to do this.

Is there a GUI type tool that allows you to mask sections of the file via a filter e.g. skip columns 10 - 16, skip data between word x and word y etc.?

From stackoverflow
  • I don't know of any GUI tools, but if you're in a unix environment, you can pipe both files through sed or awk

    #Example: skip first word
    sed 's/^[^[:space:]]*//' yourfile1 >file1.tmp
    sed 's/^[^[:space:]]*//' yourfile2 >file2.tmp
    diff file1.tmp file2.tmp
    
  • Check out WinMerge. It has the ability to filter lines based on regular expressions.

    Kurt W. Leucht : I use WinMerge a lot and had no idea it had this filtering capability! Thanks for educating me!

0 comments:

Post a Comment