Search code examples
comparecomparisonstring-comparisonbeyondcomparebeyondcompare4

Getting Beyond Compare to Match Similar Lines Properly


I am using Beyond Compare 4.1.6 to diff text configuration files. There is one configuration parameter per line, and each line is formatted as follows: :=

I would like to configure Beyond Compare such that it will align only lines when the : portion of the line is exactly the same in both files. Put differently, everything from the beginning of the line up to and including the colon must match exactly for the two lines to be aligned. Note that a colon cannot occur in , so the colon I want Beyond Compare to base its alignment decision on will always be the first colon in the line.

An example is:

# FILE 1
abcdefgh:string=5

# FILE 2
abcdefkh:string=5

Beyond Compare aligns these two lines even though I don't want it to.

I've been unable to coerce Beyond Compare to compare lines as desired by editing its grammar rules or by tweaking other features.

How may I get Beyond Compare to match lines as described above?

Thank you!


Solution

  • You can compare it with a table compare.

    Then you must set the = as field separator: enter image description here

    When you did this, you have two columns and the first is the key columns (if not, you can define it).

    After this you get the result you want (if I understood your question right): enter image description here

    If you need it often, you may store the setting in a file format.