Skip to main content

I have file1.txt

this is the original text  
line2  
line3  
line4  
happy hacking !  

and file2.txt

this is the original text  
line2  
line4  
happy hacking !  
GNU is not UNIX  

if I do: diff file1.txt file2.txt I get:

3d2  
< line3  
5a5  
> GNU is not UNIX  

How is the output generally interpreted? I think that < means removed but what do 3d2 or 5a5 mean?

If I do:

$ diff -u file1.txt file2.txt  
--- file1.txt        2013-07-06 17:44:59.180000000 +0200  
+++ file2.txt        2013-07-06 17:39:53.433000000 +0200  
@@ -1,5 +1,5 @@  
 this is the original text  
 line2  
-line3  
 line4  
 happy hacking !  
+GNU is not UNIX  
$ diff -u file1.txt file2.txt  
--- file1.txt        2013-07-06 17:44:59.180000000 +0200  
+++ file2.txt        2013-07-06 17:39:53.433000000 +0200  
@@ -1,5 +1,5 @@  
 this is the original text  
 line2  
-line3  
 line4  
 happy hacking !  
+GNU is not UNIX  

The results are clearer but what does @@ -1,5 +1,5 @@ mean?

I have file1.txt

this is the original text  
line2  
line3  
line4  
happy hacking !  

and file2.txt

this is the original text  
line2  
line4  
happy hacking !  
GNU is not UNIX  

if I do: diff file1.txt file2.txt I get:

3d2  
< line3  
5a5  
> GNU is not UNIX  

How is the output generally interpreted? I think that < means removed but what do 3d2 or 5a5 mean?

If I do:

$ diff -u file1.txt file2.txt  
--- file1.txt        2013-07-06 17:44:59.180000000 +0200  
+++ file2.txt        2013-07-06 17:39:53.433000000 +0200  
@@ -1,5 +1,5 @@  
 this is the original text  
 line2  
-line3  
 line4  
 happy hacking !  
+GNU is not UNIX  

The results are clearer but what does @@ -1,5 +1,5 @@ mean?

I have file1.txt

this is the original text  
line2  
line3  
line4  
happy hacking !  

and file2.txt

this is the original text  
line2  
line4  
happy hacking !  
GNU is not UNIX  

if I do: diff file1.txt file2.txt I get:

3d2  
< line3  
5a5  
> GNU is not UNIX  

How is the output generally interpreted? I think that < means removed but what do 3d2 or 5a5 mean?

If I do:

$ diff -u file1.txt file2.txt  
--- file1.txt        2013-07-06 17:44:59.180000000 +0200  
+++ file2.txt        2013-07-06 17:39:53.433000000 +0200  
@@ -1,5 +1,5 @@  
 this is the original text  
 line2  
-line3  
 line4  
 happy hacking !  
+GNU is not UNIX  

The results are clearer but what does @@ -1,5 +1,5 @@ mean?

edited title
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 267

Understaning Understanding of diff output

Tweeted twitter.com/#!/StackUnix/status/353577111174385665
Source Link
Jim
  • 10.7k
  • 17
  • 62
  • 88

Understaning of diff output

I have file1.txt

this is the original text  
line2  
line3  
line4  
happy hacking !  

and file2.txt

this is the original text  
line2  
line4  
happy hacking !  
GNU is not UNIX  

if I do: diff file1.txt file2.txt I get:

3d2  
< line3  
5a5  
> GNU is not UNIX  

How is the output generally interpreted? I think that < means removed but what do 3d2 or 5a5 mean?

If I do:

$ diff -u file1.txt file2.txt  
--- file1.txt        2013-07-06 17:44:59.180000000 +0200  
+++ file2.txt        2013-07-06 17:39:53.433000000 +0200  
@@ -1,5 +1,5 @@  
 this is the original text  
 line2  
-line3  
 line4  
 happy hacking !  
+GNU is not UNIX  

The results are clearer but what does @@ -1,5 +1,5 @@ mean?