beyondcomparetext-comparison

BeyondCompare: Replace first 6 digits if different via macro


we are using BeyondCompare 4 to compare two files. Is there a way to use BeyondCompare in such way that by pressing a button only the first 6 digits are copied from file A to file B?

I do not want to copy the entire line and we need to check and review if we really want to replace the first digits. So we can't use any automatic replacement via macros.

E.g.:

FileA:
(ABCD)  This is a testline
(----)  This is the 2nd line


FileB:
(0000)  This is not a testline
(ABCD)  This is the second line

After reviewing it, the new file should be FileB with the first digits of the first line of FileA:

Result:
(ABCD)  This is not a testline
(ABCD)  This is the second line

Thanks in advance,


Solution

  • I found a tricky solution.

    First you need a a new file format, defined as a table format.

    1. Tools -> File Formats
    2. Press the + and select table format
    3. Define a mask (in my case *.yyy)
    4. Set the type delimited and define a character that separates your first characters: enter image description here

    After this, you can compare your two files (in my case with extension yyy): To get the correct alignment, you must make the first column to a standard column (No key column): enter image description here Now you can go to the "Text detail" area (if you don't have it, make it visible with View->Text Detail). Here you can go to one column and copy it to the right: enter image description here

    Now you copied only one part of your file.

    Remark:

    I tried also the type fixed. The with of the first column must be as large as you need for the first digits. Then make a large 2nd column to get all other data: enter image description here This results in the following comparison: enter image description here But with this comparison I was not able to copy a single column (@Scooter-Team: Maybe this is a bug?)