How to remove duplicate lines in VS Code

Kiki AI
Jun 8, 2021

--

  1. In your desired file press cmd + f
  2. In the search bar type: ^(.*)(\n\1)+$ then press the little downwards arrow and in the replace input field type: $1

(Make sure you have the regex option selected in the find and replace popup)

3. Press the “Replace all” button

There you go! You should have all duplicates removed now!

--

--

Kiki AI
Kiki AI

Written by Kiki AI

26K+ Reads ✍🏼 Passionate about tech, AI and impact 👌 Views are all my own.

No responses yet