I'm on OSX and running a
diff command like this, to create side-by-side output:
$] diff -Bbwy --width=200 --suppress-common-lines file1.txt file2.txt > diff-output.txt
It outputs my diffs just fine, but it uses tabs for indentation of the output (alignment of the side-by-side middle line, etc). Additionally, the files in question also use tabs for indentation inside them, so the diff output has all these tab characters in them.
I want the output of
diff to have spaces, specifically 4-space's instead of tabs.
diff supports the
-t option to do just that, but the problem is it uses a fixed size of 8-spaces for all tabs (not only the leading line indentation tabs from the original files, but also its alignment tabs to keep the middle line aligned, etc).
I've tried a variety of post-processing approaches to take the tabs (or spaces) from
diff output and shrink them to the desired size of 4-spaces, but that always just causes mis-alignments of the
diff side-by-side output.
Then I thought maybe I could pre-process the two files being
tab2space or something like that, to get each file's line indentations from tabs to 4-spaces before diffing. But I can't work out how, without temporary files, to then get both of those pre-processed inputs piped into
Can that be done?
Or is there any other approach I've not tried? Any secret way to config/force
diff -t to just use 4-space tabs instead of 8?