Skip to main content
question itself is not about wdiff, wdiff just happens to be a solution
Link
muru
  • 77.9k
  • 16
  • 212
  • 318
Tweeted twitter.com/StackUnix/status/1086548967884812288
deleted 42 characters in body
Source Link
anol
  • 835
  • 1
  • 10
  • 19

I want to compare lines in two files, but to minimize noise in the output, I want only the actual differences in the lines to be printed.

For instance, given the two files below:

a.txt

a b c d e f g h i j k l m n o p q r s t u v w x y z

b.txt

a ЬB c d e f g h i j k l m n o p q r s t u v w x y z

(the difference between them is only that the second line has a cyrillic character insteadcase of a lowercaseletter b)

I want the output to be something like:

[-b-]{+Ь++B+}

Currently, the best approach I found was to use git diff --word-diff, but it outputs the whole line:

a [-b-]{+Ь++B+} c d e f g h i j k l m n o p q r s t u v w x y z

Is there a more direct way to do it, other than manually parsing the output? Also, ideally I would prefer to use something more commonly available than git diff, e.g. a POSIX shell tool that would not require the user to install extra packages.

I want to compare lines in two files, but to minimize noise in the output, I want only the actual differences in the lines to be printed.

For instance, given the two files below:

a.txt

a b c d e f g h i j k l m n o p q r s t u v w x y z

b.txt

a Ь c d e f g h i j k l m n o p q r s t u v w x y z

(the difference is only that the second line has a cyrillic character instead of a lowercase b)

I want the output to be something like:

[-b-]{+Ь+}

Currently, the best approach I found was to use git diff --word-diff, but it outputs the whole line:

a [-b-]{+Ь+} c d e f g h i j k l m n o p q r s t u v w x y z

Is there a more direct way to do it, other than manually parsing the output? Also, ideally I would prefer to use something more commonly available than git diff, e.g. a POSIX shell tool that would not require the user to install extra packages.

I want to compare lines in two files, but to minimize noise in the output, I want only the actual differences in the lines to be printed.

For instance, given the two files below:

a.txt

a b c d e f g h i j k l m n o p q r s t u v w x y z

b.txt

a B c d e f g h i j k l m n o p q r s t u v w x y z

(the difference between them is the case of letter b)

I want the output to be something like:

[-b-]{+B+}

Currently, the best approach I found was to use git diff --word-diff, but it outputs the whole line:

a [-b-]{+B+} c d e f g h i j k l m n o p q r s t u v w x y z

Is there a more direct way to do it, other than manually parsing the output? Also, ideally I would prefer to use something more commonly available than git diff, e.g. a POSIX shell tool that would not require the user to install extra packages.

added 103 characters in body
Source Link
anol
  • 835
  • 1
  • 10
  • 19
Loading
added 83 characters in body
Source Link
anol
  • 835
  • 1
  • 10
  • 19
Loading
Source Link
anol
  • 835
  • 1
  • 10
  • 19
Loading