How to delete lines from 1001 to 2000 in the file with 10,000 lines using the vim editor? The command :d999d causes the error E488: Trailing characters

  • Earned, the keyboard layout is necessary - it turns out to take into account :) - hellog888
  • 3
    You, as the author, can delete the question. - aleksandr barakin
  • one
    I do not understand what they want about me Requiring edits? - hellog888

2 answers 2

The dd and d<количество>d commands are executed without :

To the command :d you can specify a range of lines, then your task is solved as follows:

 :1001,2000d 
  • It is a pity that few people read the initial tutorials that go to all the free * nix editors. After vim it is worth looking sed a stream editor, a magic wand for any self-respecting unixoid. - Hellseher

Before most commands, you can enter a number, meaning how many times the command is executed.

Then the obvious (and requiring minimal knowledge in vi) way:

  • get to the top of the file

  • dial 1000 and immediately "arrow down"

  • dial 999dd

Everything, you can save the file.

  • Needless to say, it never occurred to me to press the 1000 down arrow. Always pressed 1000 j - AK
  • @AK, always 1000gg . - aleksandr barakin