[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vi globally append question



On Thu, Jul 15, 2004 at 11:05:32AM -0400, David Turetsky wrote:
> > i have a file like;
> > 
> > #
> > one
> > 123
> > 
> > and i would like to APPEND a # at the beginning of
> > each line which is not started with a # . how can i do
> > it with vi or ed, so far, i 've tried;
> > 
> > :%s/^[a-z]:[0-9]/#/g
> > 
> > but this would CHANGE the first character of each line
> > to a hash, pls help.

:1,$s/^\([^#].*\)/#\1/

should do it in vi.

Regards
Matthias



Reply to: