0

Say I want to diff two files:

diff --ignore-space-change foo.go bar.go

is there a way to print only the first line change - basically to tell diff to stop working after the first line change is detected - and print that change?

For example, say file1 is:

a
b
c
d

and file2 is:

a
b
y
z

then I am looking for a tool that prints something like:

<file1
c
>file2
y

that's all

  • huh? I just want to print the first line diff/change –  Jul 07 '20 at 19:04
  • 3
    Does this answer your question? [diff command to get number of different lines only](https://stackoverflow.com/questions/27236891/diff-command-to-get-number-of-different-lines-only) – Giorgi Tsiklauri Jul 07 '20 at 19:16
  • 1
    Do you need to see the change, its location, or just the fact that there is a diff? – Benjamin W. Jul 07 '20 at 19:29
  • no i am looking for the first line changes only...so if there are 20 lines difference, I just want to see the first –  Jul 08 '20 at 01:35
  • Simply stating "my question is not a duplicate" without explaining why it is not a duplicate will not get your question reopened. – pppery Jul 08 '20 at 16:56
  • look at the OP - the linked question says "just get the line count difference" this question is to print the text difference of the first line change. Very different, it's stated in the question. –  Jul 08 '20 at 17:48

0 Answers0