I want to get the correct number of lines in the output of diff(specifically with
--suppress-common-lines options). Using a simple
wc -l does not work, because if both files end without a newline and their last line is different
wc -l won't count the last line.
Is there a simple and efficient solution to avoid this?
For example, if you have files "a":
a b c d #no newline here
a b c D #no newline here
The output is:
$ diff -y --suppress-common-lines a b | wc -l 0
Which is obviously incorrect since
diff does output a line.