Auto Select/Remove all but one duplicate links and links to self

When building composite notes, it would be nice to have an analyzer plugin that could select all but one duplicate links within a note. It could also select all links to self.

This plugin may be able to run in batch mode perhaps with an option to automatically remove these duplicate and self links with the click of a button within all notes or the results of a search.

Thanks.