I want to delete the line: This is an examplethat happens several times in the file. How should I do it.
This is an example
Thanks Alisha
You can do:
:g/This is an example/d
:%s/This is an example\n//gc % indicates all lines of a file s indicates pattern to be searched. g for global replacement c for confirmation on each replace
If you want to delete lines containing only exact matches, you can:
:g/^This is an example$/d
You can do this using an external command:
:%!grep -v "This is an example"
Filters the entire file with this command. The command grep -vselects all lines of the file that do not match the given regular expression.
grep -v