1. Show all the lines that match a pattern, say
g!” or “
v” for negative matching. For example, to show all the lines that DO NOT match the pattern,
2. Delete all the lines that contain the pattern,
v may be used for negative matching.
Application: You may use any of the following two commands to delete all the blank lines (including lines containing only whitespaces) from a file
Reference: Vim Wiki.