[CLUE-Tech] vi search/replace question
Angelo Bertolli
angelo at freeshell.org
Fri Apr 23 09:13:32 MDT 2004
On Thu, 22 Apr 2004, Dave Price wrote:
> Date: Thu, 22 Apr 2004 10:54:50 -0600
> From: Dave Price <dp_kinaole at yahoo.com>
> Reply-To: clue-tech at clue.denver.co.us
> To: clue-tech at clue.denver.co.us
> Subject: [CLUE-Tech] vi search/replace question
>
> Hello,
>
> 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'?
What I wrote before will remove the line
:0,%s/^#//g
I just realized you probably don't want to remove the line
:0,%s/^#/\n/g
I hope that's what you were asking...
Angelo
More information about the clue-tech
mailing list