On Tue, 2002-10-01 at 11:32, Tony Green wrote:
> On Tue, 2002-10-01 at 11:27, Simon Wong wrote:
> > vi gurus,
> >
> > I've done some googling but couldn't find something to tell me how...
> >
> > I want to comment out every line in a file (inetd.conf) but not the ones
> > that already are.
> >
> > I tried
> >
> > :1,$s/^/#
> >
>
> %s/^[^#]/#/
For regular expression (regex) newbies, the two carets ('^')
in this expression have different meanings.
The first caret means "start of line". The second caret
immediately follows the opening square bracket of a character
class, so it means "NOT any of the characters listed within
the square brackets".
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug