I got a large file today, and there were many duplicate lines in the middle that needed to be removed. Most of the online search results required the use of the TextFX plug-in to sort and remove duplicates. It really didn't meet my needs, so I searched for a solution on Google. , I don’t dare to use it exclusively. In fact, it is replaced with a regular expression. The expression is as follows:
1 |
^(.*?)$\s+?^(?=.*^\1$) |
The operation method is as follows, shortcut key Ctrl+H, enter the expression in the pop-up interface, and check Match New Line, as shown in the figure:
Then click Replace All to see if there are no more duplicate rows~