0

This question already has an answer here:

I'm having an extremely hard time to read this can someone explain what it means, and what the difference between the two is ?

$> diff -U 3 user_output_test1 test1.output | cat -e
--- user_output_test1   2018-10-31 22:21:45.000000000 -0700$
+++ test1.output        2018-10-31 22:21:45.000000000 -0700$
@@ -9,8 +9,8 @@$
 '-+2A' '0123456789ABCDEF'=0$
 '+-2A' '0123456789ABCDEF'=0$
 '++2A' '0123456789ABCDEF'=0$
-'2-A' '0123456789ABCDEF'=0$
-'+2-A' '0123456789ABCDEF'=0$
+'2-A' '0123456789ABCDEF'=2$
+'+2-A' '0123456789ABCDEF'=2$
 '2a' '0123456789ABCDEF'=0$
 '' '0123456789ABCDEF'=0$
 '22' '2'=0$

Thanks.

marked as duplicate by αғsнιη, Community Nov 1 '18 at 18:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

user_output_test1 has two lines:

'2-A' '0123456789ABCDEF'=0
'+2-A' '0123456789ABCDEF'=0

that differ from test1.output, who has these two lines, instead:

'2-A' '0123456789ABCDEF'=2
'+2-A' '0123456789ABCDEF'=2

The substantive difference being the =0 turning into =2's.

The leading - symbol indicates lines that would be removed from the first file, while the leading + symbol indicates lines that would need to be added to the first file in order to result in the second file.

The unified diff -U is what creates this general diff format, while the 3 reinforces the default context of 3 lines around each change. Those "context" lines have a leading space instead of a + or -.

Adding cat -e simply added the trailing $ symbols.

Not the answer you're looking for? Browse other questions tagged or ask your own question.