From owner-freebsd-questions Wed Nov 1 11:56:53 2000 Delivered-To: freebsd-questions@freebsd.org Received: from 2711.dynacom.net (2711.dynacom.net [206.107.213.3]) by hub.freebsd.org (Postfix) with ESMTP id 46A8637B479 for ; Wed, 1 Nov 2000 11:56:51 -0800 (PST) Received: from urx.com (dsl1-160.dynacom.net [206.159.132.160]) by 2711.dynacom.net (Build 101 8.9.3/NT-8.9.3) with ESMTP id LAA00168; Wed, 01 Nov 2000 11:56:43 -0800 Message-ID: <3A00757B.D444AED0@urx.com> Date: Wed, 01 Nov 2000 11:56:43 -0800 From: Kent Stewart Reply-To: kstewart@urx.com Organization: Dynacom X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: 8773836928@skytel.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: vi question References: <200011014727.589586540@skytel.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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