0

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.

filbranden
  • 21,751
  • 4
  • 63
  • 86
AymenTM
  • 277

1 Answers1

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.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255