How can I delete multiple lines in vi?

后端 未结 11 1303
天命终不由人
天命终不由人 2021-01-29 20:53

I have tried to follow the following:

How to delete selected text in VI editor

but

5dd

gives

E492: Not a

11条回答
  •  渐次进展
    2021-01-29 21:27

    You can delete multiple(range) lines if you know the line numbers:

    :[start_line_no],[end_line_no]d
    

    Note: d stands for delete

    where,
    start_line_no is the beginning line no you want to delete and end_line_no is the ending line no you want to delete. The lines between the start and end, including start and end will be deleted.

    Eg:

    :45,101d
    

    The lines between 45 and 101 including 45 and 101 will be deleted.

提交回复
热议问题