User Tools

Site Tools


docs:diff:examples

diff(1) examples

files used

file a:

a
01
02
03
04
05
06
07
08
09
10

file b (“06” is missing):

b
01
02
03
04
05
07
08
09
10

file c (“06a” inserted):

c
01
02
03
04
05
06
06a
07
08
09
10

file d (“06a” replaces “06”):

d
01
02
03
04
05
06a
07
08
09
10

one deleted line

diff a b

6d5
< 06

diff -u a b

--- a   2014-04-09 11:59:40.347723727 +0200
+++ b   2014-04-09 11:59:51.651574650 +0200
@@ -3,7 +3,6 @@
 03
 04
 05
-06
 07
 08
 09

diff -e a b

6d

one additional line

diff a c

6d7
> 06a

diff -u a c

--- a   2014-04-09 11:59:40.347723727 +0200
+++ c   2014-04-09 12:08:41.088672486 +0200
@@ -4,6 +4,7 @@
 04
 05
 06
+06a
 07
 08
 09

diff -e a c

6a
06a
.

one line changed

diff a d

6c6
< 06
---
> 06a

diff -u a d

--- a   2014-04-09 11:59:40.347723727 +0200
+++ d   2014-04-09 12:12:33.541634228 +0200
@@ -3,7 +3,7 @@
 03
 04
 05
-06
+06a
 07
 08
 09

diff -e a d

6c
06a
.

output of "diff -u" explained

file name 1
file name 2
a TAB char as separator
a TAB char as separator
date of file 'a'
date of file 'b'
a 'hunk'
range of the original file ('a') with '3' representing the starting line number and '7' the number of lines the hunk applies to
range of the original file ('b') with '3' representing the starting line number and '7' the number of lines the hunk applies to
removed line
added line

see also

docs/diff/examples.txt · Last modified: 2015/09/15 05:14 by 91.89.129.106