Using diff to find parts of many files that are the same? (bizzaro-diff or inverse-diff)

Bizzaro-Diff !!!

Is there any way to make bizzaro / inverse-diff that only displays parts of a group of files that are the same? (IE path more than three files )

An odd question, I know ... but I'm turning someone's ancient static pages into something a little more manageable .

+3
source share
4 answers

You need a clone detector. It discovers similar code fragments through large sources. See Our ClonedR Tool: http://www.semdesigns.com/Products/Clone/index.html

+1

comm ( common). 2 , 3+ .

+1

sim. , , , .

+1

.

If I had to do this quickly and dirty, I would probably do something like diff -U 1,000,000 (assuming the version of diff that supports it) passed through sed to just get the common lines (and strip leading spaces). However, you will have to iterate over all the files.

Edit: I forgot that there is a Tcl implementation that would be a little more universal, but would require more coding. You can find an implementation for your language of choice.

0
source

Source: https://habr.com/ru/post/1702844/


All Articles