BeyondCompare text diff report syntax

146 Views Asked by At

I once wrote this silly script to convert a file diff report to an HTML that colours different types of differences. The problem is I can't recall which diff file syntax it is supposed to read. The script seems expecting some lines beginning with Only in, diff, +++ and so.

I no longer have BeyondCompare so can't test, and I can't find sample diff reports.

Question: Does it expect a BeyondCompare text diff report?

Usage: echo some_diff_file | this_script > HTML_file

# The -r option keeps the backslash from being an escape char.
read -r s

while [[ $? -eq 0 ]]
do
    # Get beginning of line to determine what type
    # of diff line it is.
    t1=${s:0:1}
    t2=${s:0:2}
    t3=${s:0:3}
    t4=${s:0:4}
    t7=${s:0:7}

    # Determine HTML class to use.
    if  [[ "$t7" == 'Only in' ]]; then
        ...
    elif [[ "$t4" == 'diff' ]]; then
        ...
    elif  [[ "$t3" == '+++'  ]]; then
        ...
    elif  [[ "$t3" == '---'  ]]; then
        ...
    elif  [[ "$t2" == '@@'   ]]; then
        ...
    elif  [[ "$t1" == '+'   ]]; then
        ...
    elif  [[ "$t1" == '-'   ]]; then
        ...
    else
        ...
    fi
done
1

There are 1 best solutions below

0
Chris Kennedy On

That doesn't look like Beyond Compare's report syntax.

Beyond Compare 4.4.1 (current version) doesn't use 'Only in' in plain text reports.

Beyond Compare runs as a fully functional trial for 30 days before a license is required if you'd like to generate test reports. In Beyond Compare's Text Compare, select Session > Text Compare Report to generate a report.

Beyond Compare Reports can output to HTML as well as plain text. It isn't necessary to output to plain text then convert to HTML outside of Beyond Compare.

Example Text Compare Report from Beyond Compare 4.4.1, output as plain text, with Side-by-side selected as the report layout:

Text Compare
Produced: 2/15/2022 9:05:03 AM

Mode:  All
Left file: C:\work\1.txt     Right file: C:\work\2.txt
left orphan       +-
---------------------------------------
same              =  same
---------------------------------------
line with an edit <> line with a change
                     right orphan
---------------------------------------

Plain text report layouts supported: side-by-side, summary, interleaved, patch, statistics, XML dump.