How do I run a command on every line matching a pattern?
:g/pattern/command
The :g/pattern/command (global) command executes an Ex command on every line in the file that matches the given pattern.
:g/pattern/command
The :g/pattern/command (global) command executes an Ex command on every line in the file that matches the given pattern.
:cfdo %s/old/new/g | update
The :cfdo %s/old/new/g update command performs a search and replace across every file in the quickfix list and saves each one.
:g/pattern/d
The :g/pattern/d command deletes every line in the file that matches the given pattern.