Search for string and get count in vi editor

前端 未结 8 1784
小鲜肉
小鲜肉 2021-01-30 01:12

I want to search for a string and find the number of occurrences in a file using the vi editor.

8条回答
  •  清酒与你
    2021-01-30 01:44

    :g/xxxx/d
    

    This will delete all the lines with pattern, and report how many deleted. Undo to get them back after.

提交回复
热议问题