Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Nov 2000 11:56:43 -0800
From:      Kent Stewart <kstewart@urx.com>
To:        8773836928@skytel.com
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: vi question
Message-ID:  <3A00757B.D444AED0@urx.com>
References:  <200011014727.589586540@skytel.com>

next in thread | previous in thread | raw e-mail | index | archive | help


8773836928@skytel.com wrote:
> 
> Hello,
> 
> I have been editing some
> Perl scripts in vi recently,
> and I find it very annoying
> that Perl cannot comment
> blocks of code, only lines.
> 
> I have been reading the docs in vi, but I can't quite figure out how to do a substitute command that will, say, prepend a # to the next n lines, and later remove the # ( well, the second one I could always use :s and replace the first # with nothing for the next n lines. But the first one is still a mystery to me ).

The regular expression for the beginning of a line is ^ and the end of
the line is $.

If you are in column 1 on line 1, you can
:.,$s/^/#/

To remove the #, you would
:.,$s/^#//

HTH,

Kent

> 
> Any insight would be greatly appreciated.
> 
> Thanks!
> 
> P.S. Please cc: me, as I am not subscribed to the list with this account. Thanks again.
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
Kent Stewart
Richland, WA

mailto:kbstew99@hotmail.com
http://kstewart.urx.com/kstewart/index.html
FreeBSD News http://daily.daemonnews.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A00757B.D444AED0>