Q:

How to automatically remove all duplicates property key in bundle resources in .properties file

I'm using Intellij Idea 2019.1.3. I have in bundle resources .properties files with a lot of duplicates property key.
Is it possible to automatically remove all duplicates in this kind of file?

A:

I don't think IntelliJ can do that OOB.
I would sort lines (using this plugin), which will make duplicate lines be on adjacent lines. Then just remove duplicates by replacing (^.+$)\n\1 by $1
(^.+$)\n\1 - find duplicate lines separated by the new line character
$1 - back reference to the line

