Permissions - Clean way to convert per player perm to group?

Morning

I'm looking for a solution to correct a bad decision when the server was setup some years ago, we need to convert a permission that has been granted at player level for the last three years into a permission given to a group and move those players into the new group.

I'm hoping there is some kind of command or plugin that can find every player with a specific perm e.g. pluginxyz.use and add them to a group. Anyone aware of something that can do this?

You could have something made to handle it pretty easily. You can see my Migration plugin as an example. 

Thanks. I found that after posting and used it as the basis for a plugin to create the group, move players in that have a certain perm and take the old perm away.

Thanks for your work