How do I "merge" multiple duplicates in media library?

I've imported thousands of articles from an old CMS to a new WordPress site, everything worked fine, and all the images got uploaded to the media library and attached.

The problem is that a lot of articles used the same images over and over, but they all got imported as individual/duplicate images. So now I have a bunch of files like:

- a_specific_filename.jpg
- a_specific_filename1.jpg
- a_specific_filename2.jpg

And so on. I would like to "merge" all media library items which are the same.

The dream scenario would be a plugin where:

1. I could search for images (a_specific_filename)
2. get a list with the results with a checkbox on each
3. check everyone that I see are the same (or should be)
4. pick one image to be master image/the right one
5. replace all other occations/attachments with the right one
6. remove all duplicates.

Would this be possible? How to do it?