I’m trying to achieve a simple substitution on vim but can’t get it right. I need to remove, on an entire file, all the lines that match a pattern. The pattern is “something*”, meaning “something” followed by anything until the end of the line.
I tried :%s/pattern*\n//g and :%s/pattern*$//gwithout success.
Any ideas?
Cheers!
Use
:ginstead of:substitute.would remove all the lines that match with pattern.
As for the pattern, yours will match
patter,pattern,patternnand so on. Use the wildcard.to match any characters. So your regexp should bepattern.*$— but if you wish to remove the lines entirely, the:g/pattern/ddoes the trick fine.