skip to Main Content

I have a csv that looks wrong on certain lines so I want to delete lines manually in line range 1 to 281387 using Visual Studio Code as Text Editor.

vs code

I’ve tried using the cursor and Ctrl + Shift + from line 281387 to line 1 but it takes a very long time. Is there a quick way to solve this problem?

3

Answers


  1. The quick way is to not use vscode 😉

    Unhelpful cheekiness aside, use vim or emacs to make quick work of this. Assuming you haven’t installed emacs, vim is likely already on your machine. If you’re windows, go install neovim.

    1. Open vim to that file (vim /path/to/that/file) or nvim if you are using neovim
    2. Press the escape button (gets you into normal mode)
    3. hit gg (gets your cursor to the top of the file)
    4. Now type 281387dd and hit enter (this runs the delete lines dd command however many times you asked it to)
    5. If it looks right, type :wq to save the file and quit vim (:q! to just quit without saving)
    Login or Signup to reply.
  2. An extension like Select Line Range allows to quickly select any range of lines in your document, including from the cursor to any line. Then just delete.

    Login or Signup to reply.
    • cursor on line 281837 or start of 281838
    • and then key Ctrl+Shift+Home
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search