How to change diff side by side markers to other ones?

I use

diff -y <file1> <file2>


sdiff <file1> <file2>

but I can’t find how to change markers from the defaults which are:


In particular, I would like to add a visible equality marker (as default one is a whitespace) replacing it with (for example):


to achieve something like:

ab c  | ab d
efg   = efg

Tried to quickly read the code at but didn’t manage to find the place responsible for the markers (column delimiters).

Asked By: Alexander Ites


The markers are handled in the last three functions of in print_sdiff_hunk. There’s no option to override them.

You could post-process the output, relying on the fact that for a given width, the markers will always be in the same position in the output.

Answered By: Stephen Kitt
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.