This tutorial shows multiple examples to remove duplicate lines in Sublime text.

Let’s have a first.txt file opened in a sublime text editor.

Eric
Andrew
Eric
John
Matt
John

One way is, to hover over a line and select a text, manually removing the duplicate lines.

It is easy for files of small sizes. However, It is a very tedious task for a larger file that contains many lines of text.

How to remove duplicate rows in Sublime Text

  • Open the text file that you want to remove duplicate rows
  • Select Edit > Permute Lines > Unique
  • It removes the duplicate lines and the output is as follows This option also removes duplicate line spaces if exist.
Eric
Andrew
John
Matt

Permute Lines has the following options.

Unique: delete the duplicate lines Shuffle: Shuffle the lines in the file Reverse: Reverse the lines, the first line becomes the last line and the last line becomes the first line

The order of lines keeps the same order and does not sort with this option.

If you want to sort the lines and delete duplicates.

  • Select Edit > Sort Lines( use F9 shortcut)
  • Next, Select Edit > Permute Lines > Unique
  • It sorts the lines and removes the duplicate lines

How to copy the duplicate text in Sublime text editor

Select the line you want to duplicate line by hovering over a text, Run the below short cut command.

  • Ctrl + Shift + D in windows
  • Cmd + Shift + D in MacOS