Question

Maybe I just don't see the wood for the trees. I am trying to understand how to interpret the highlighted numbers.

This is taken from the manual page.

diff -u lao tzu

The difference is given as:

--- lao Sat Jan 26 23:30:39 1991
+++ tzu Sat Jan 26 23:30:50 1991

@@-1,7 +1,6@@

-The Way that can be told of is not the eternal Way;
-The name that can be named is not the eternal name.
 The Nameless is the origin of Heaven and Earth;
-The Named is the mother of all things.
+The named is the mother of all things.
+
 Therefore let there always be non-being,
   so we may see their subtlety,
 And let there always be being,

@@-9,3 +8,6@@

 The two are the same,
 But after they are produced,
   they have different names.
+They both may be called deep and profound.
+Deeper and more profound,
+The door of all subtleties!

The help file says:

@@ from-file-range to-file-range @@
 line-from-either-file
 line-from-either-file...

How do I have to interpret @@ -1,7 +1,6 @@ and @@ -9,3 +8,6 @@? Probably, this is really obvious, but I just don't get the idea. Thank you!

Was it helpful?

Solution

@@-1,7 +1,6@@

That tells you what lines of the files the following change hunk apply to.

  • -1 means that the following change hunk starts on line 1 of the original file.
  • 7 means that the change hunk applies to 7 lines of the original file.
  • +1 means that the change hunk starts on line 1 of the new file.
  • 6 means that the change hunk applies to 6 lines of the new file.

In the change hunk that follows, lines preceded with a - were deletion lines, lines preceded with a + were addition lines, and lines preceded with a (space) were unchanged.

Reference: diff - Unified format

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top