I know that you can remove duplicate lines by doing Edit>Permute Lines>Unique
. But that will remove blank(empty) lines. I would like not to remove them, so blank lines will stay(essentially empty space).
CodePudding user response:
You can do this using Permute Selections. First, open the Find menu (CtrlF or Find → Find…
) and make sure the Regex, Wrap, and Highlight matches buttons are selected. In the search field, enter ^. \n
. This matches the beginning of the line ^
, 1 or more characters of any type .
, and the newline character(s). Therefore, it will select any line that is NOT just a newline. Note that this will select lines that contain only whitespace, for example a tab character followed by a newline.
Next, hit the Find All button to select each line individually.
Finally, select Edit → Permute Selections → Unique
and all duplicate lines will be erased, leaving all blank lines behind.