2 English contractions use apostrophes.
source | link

I want to get the correct number of lines in the output of diff(specifically with -y and --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 wontwon'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

And "b":

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.

I want to get the correct number of lines in the output of diff(specifically with -y and --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 wont 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

And "b":

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.

I want to get the correct number of lines in the output of diff(specifically with -y and --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

And "b":

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.

    Tweeted twitter.com/#!/StackUnix/status/264712673483165697
1
source | link

Get correct number of lines in diff output

I want to get the correct number of lines in the output of diff(specifically with -y and --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 wont 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

And "b":

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.