Delete from the current cursor position to a given line number in vi editor

To delete from a to b use

:a,bd

from current to b use

:,bd

(where a and b in code are replaced by your numbers)


Why count lines? Go to the last line you want to delete and mark it by typing ma which "marks" it with identifier "a". Then go up to the top line that you want to delete and type d'a for delete to mark "a". Bam!


You could use something like d63G to delete from the current line until line 63.


Same as the accepted answer, but slightly faster to type:

d63gg deletes from the current line to line 63.

Tags:

Vi

Editing