[CLUE-Tech] vi search/replace question

Angelo Bertolli angelo at freeshell.org
Fri Apr 23 09:10:39 MDT 2004


> This one comes up too often for me, and I don't know if there is an easy
> way to do it just with vi/vim:
>
> Is there a way to delete entire lines globbally from a file when part
> of the line matches a pattern?
>
> For example, I want to remove all the lines the start with a particular
> character, perhaps #, (so the regex to find the lines would be ^# ...
>
> How can I tell vi to replace the regex and the rest of the line with
> 'nothing'?

:0,%s/^#//g




More information about the clue-tech mailing list