How to remove lines from a to b in a text file using the editor vi ?

Published: May 08, 2020

DMCA.com Protection Status

Example of how to remove lines from a to b using vi editor ?

1 -- Remove lines from a to b (with b>a)

To delete lines from a to b, a solution is to use the command:

:m,nd

Note: to remove from the current line to line n:

:,nd

2 -- Remove all lines

Note: to remove all content in the file:

:1,$d

3 -- References