How can I find a match in the source files of several programs? [closed]

There are 10 ready-made projects. Developers often rewrote the same things instead of separating it into a separate package. Is there a utility that would help me with finding matches in files so that I can quickly put it into separate packages?
I’m looking for something like a diff that would help me solve the problem.