Text Compare Help
OVERVIEW
Text Compare is a tool for determining which lines are unique and which are the same in two text files
(such as AHK scripts). It compares each line in the first file to each line in the second file and vice versa. Each of these
comparisons results in 5 possibilities.
Assume that Text Compare has cycled through the first 20 lines of each file and is now at #21. The five possible outcomes
for line #21 (in both file 1 and file 2) are:
- Line #21 from file 1 and line #21 from file 2 are both unique, meaning neither of them matches any line in the
opposite file.
- Line #21 from file 1 is unique; but line #21 from file 2 is not, meaning line #21 in file 1 does not match any
lines in file 2;
but line #21 in file 2 does match at least one line in file 1. The line from file 2 is
a mismatch.
- Line #21 from file 2 is unique; but line #21 from file 1 is not, meaning line #21 in file 2 does not match any
lines in file 1;
but line #21 in file 1 does match at least one line in file 2. The line from file 1 is
a mismatch.
- Line #21 from file 1 and line #21 from file 2 are not unique, meaning both of them match at least one line in
the opposite file,
but not each other. Both lines are mismatches.
- Line #21 from file 1 and line #21 from file 2 are the same.
If the two text files being compared do not contain the same amount of lines, the additional lines contained in the longer
file will still be compared to each line of the shorter file. For example, if file 1 has 25 lines, but file 2 only has 20,
then lines 21-25 of file 1 will still be compared to the lines in file 2. The comparison will obviously not work the other
way; however, so it will only result in 2 possibilities: the additional lines from the longer file can either be unique or
mismatched.
OPTIONS
Text Compare has 3 options which may be applied:
Ignore white space.
Report mismatches
Output in HTML
- Normally the final report will be generated as a plain text file. Checking this box will instead render an
HTML file for the report.
The main advantage of the HTML output is that it is color
coded, making differences between lines easier to discern.
- Note that HTML does not have a "tab" character, so tabs will be replaced by 5 spaces instead.
If white-space is important,
(i.e. "Ignore white space" is not checked) leave the HTML option
unchecked also, to more effectively show tabs in the final report.
FINAL REPORT
If differences are found between two files being compared, a final report file will be written. The final report will be
either a plain text or HTML file generated in the directory where Text Compare is located. The first two lines of the final
report will be the complete paths of the two files being compared, and the last line of the report will be the number of
differences found. In between will be the line numbers, type of conflict, and text of the lines which do not match.
When the “Report mismatches” option is not checked, the final report is very straightforward, since it will only be reporting
unique lines. It will therefore list only a single line number followed by the name of the file with a unique line and the
text of that line.
A final report containing mismatches is longer and more complicated. When a mismatch is detected, the final report will list
its line number as well as the line number where a match was found in the opposite file. For example, if the final report
shows a mismatch at 21:12, it means that line 21 of file 1 is the same as line 12 of file 2.
Since Text Compare looks at each line number in both files, there can potentially be a mismatch on both lines (outcome 4 in
the overview). In this instance, the final report would show something like: 21:12/21:25. This means that line 21 of file 1
is the same as line 12 of file 2, and line 21 of file 2 is the same as line 25 of file 1. Notice that the first and third
number will always be the same, since Text Compare only operates on one line number at a time.
If the “Report mismatches” option is checked and the “Ignore white space” option is checked, the final report will not
show blank lines as mismatches, even if they occur in both files. For blank lines, the line number will be reported as #
instead of the actual line number. The # symbol will also denote line numbers beyond the end of a file in cases where
file 1 and file 2 are not the same length. So, if the final report shows 21:#/21:12, it means that line 21 of file 1 is blank
or nonexistent, while line 21 of file 2 matches line 12 of file 1. In this instance, the mismatched text shown will be from
file 2, since there is no text to be shown from file 1.