The $difference printed in html file only shows the difference - top & bottom (maybe 2 or 3 lines from 1000 lines).$a = "/path/to/a/file"; $b = "/path/to/b/file"; $difference = system("$diff $a $b"); $difference2 = system("$diff -y $a $b");
But the $difference2 printed in html file shows all the difference in 2 columns -left & right (1000 lines from 1000 lines).
The output is actually fine, since I dont want to compare line by line, as sometime one has some extra lines while the other dont,So i want those extra lines which is in a and in b at the same file same time.
Here, I am wondering if it is possible to have the sort of combination of both $diff and $diff -y, having 2 left/right columns of difference in some lines only (not showing every lines)So that, $difference will shown in 2 columns with the line of differences in file.if ($difference eq ''){ $difference = "Exactly Same.\n"; } push @table1, "<table id =\"Table1\">"; push @table1, "<tr><th>path A</th><th>A</th><th>path B</th><th>B</th>< +/tr>"; push @table1, "<tr><td colspan =\"4\">$difference</td></tr>";
Any idea guys ?
In reply to diff vs diff -y by MissPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |