2

I Don't need a tool I need an implemetation/alghorithm :) I need to make a shellscript because I can't install anything on the server

f2.txt

She has 123 apples
George 18 years is old
Florin it's leaving
Michael it's not here
Peter is smiling

f1.txt

She has 132 apples
George is 18 years old
Michael it's not here
Peter is smiling
He is sleeping

Desired output:

diff is at:
line 1 : 123 instead of 132
line 2 : 18 years is instead of is 18 years
lines missing:
He is sleeping
lines added:
line 3: Florin it's leaving
Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

1 Answers1

3

Not exactly the format you're asking for, but wdiff is probably your best bet:

$ wdiff f1.txt f2.txt
She has [-132-] {+123+} apples
George [-is-] 18 years {+is+} old
{+Florin it's leaving+}
Michael it's not here
Peter is smiling
[-He is sleeping-]
Satō Katsura
  • 13,368
  • 2
  • 31
  • 50