From owner-freebsd-questions Thu Nov 2 14:25:51 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mta07-svc.ntlworld.com (unknown [62.253.162.47]) by hub.freebsd.org (Postfix) with ESMTP id B0D1137B4C5 for ; Thu, 2 Nov 2000 14:25:43 -0800 (PST) Received: from parish ([62.253.88.166]) by mta07-svc.ntlworld.com (InterMail vM.4.01.02.27 201-229-119-110) with ESMTP id <20001102222536.HZZH13163.mta07-svc.ntlworld.com@parish>; Thu, 2 Nov 2000 22:25:36 +0000 Received: (from mark@localhost) by parish (8.11.0/8.11.0) id eA2MPpV02940; Thu, 2 Nov 2000 22:25:51 GMT (envelope-from mark) Date: Thu, 2 Nov 2000 22:25:51 +0000 From: Mark Ovens To: David Talkington Cc: freebsd-questions@freebsd.org Subject: Re: vi question Message-ID: <20001102222551.A254@parish> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: ; from dtalk@prairienet.org on Wed, Nov 01, 2000 at 09:45:17PM -0600 Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Nov 01, 2000 at 09:45:17PM -0600, David Talkington wrote: > -----BEGIN PGP SIGNED MESSAGE----- > > > [Perhaps off-topic, I'm sorry ...] > > Now, that's interesting. Forgive my ignorance, but what is that > "substitution" really doing? It's my understanding that the > start-of-line meta represents a position (immediately left of the > first character in the line), and not an actual character ... which > suggests that it can be located as an anchor, but not removed or > altered. Obviously, the start of the line isn't "replaced" in this > case ... is this just a funky way to fool the regex (e.g. unexpected, > but useful, behavior)? > It's a kind of shorthand. Just using ``^'' (which as you quite rightly state is an anchor) is equivalent to: :7,17s/^\(.*\)/#\1/ i.e. replace anything at the start of the line with #anything HTH > - -d > > - -- > David Talkington > Community Networking Initiative > dtalk@prairienet.org > 217-244-1962 > > PGP key: http://www.prairienet.org/~dtalk/dt000823.asc > > Annelise Anderson wrote: > > >There are two ways I know of to comment a block of lines in vi. > > > >1) Turn on line numbering with :se nu ; the do: > > > >:7,17s/^/#/ > > > >This puts a # at the beginning of lines 7 through 17. > > > >2) Put cursor on line where you want to start the substitution > >do this: > > > >:.,+10s/^/#/ > > > >That starts at the line you're on (the .) and for that line and > >the next 10 lines (11 total) places a # at the beginning of the line. > >This is especially useful in editing a kernel config file. > > > >Annelise > > > > > >On Wed, 1 Nov 2000 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 ). > >> > >> 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 > >> > > > > > > > >To Unsubscribe: send mail to majordomo@FreeBSD.org > >with "unsubscribe freebsd-questions" in the body of the message > > > > -----BEGIN PGP SIGNATURE----- > Version: PGP 6.5.8 > Comment: Made with pgp4pine 1.75-6 > > iQEVAwUBOgDjUr1ZYOtSwT+tAQF1TQf/Uany60BTGmAQgqhILuMHH+3WZt/JlMPi > ZzzYucDAIf0T8x3G3UljU0uQnhSJmqbVaUwHBk50HE76B7b2ieK0AC0IQ84mC4SQ > z22pR9lkQ5akjnTJ5zcvRsc39GNiI68InvcqfUAfy5cTLIJ8j8oNd5fJjH96LMML > Wg0w4LMHnMGVxMXt4o8fVqg26b6oL7zP0lvez+BfwoOp9BzLgHr2O5Wf/YViISUC > U+uo3iFuTsxO4+5qQ2BvCZ1pLQSMYy49fQ5tvhpDscg02ev+LXSdwCx6422Z3hZf > Br2xFjKbe6aGbm26wSSt8xx+zsLYqSmrWfvlE4k3cIIZ8x7C33Bvjw== > =TASF > -----END PGP SIGNATURE----- > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- 4.4 - The number of the Beastie ________________________________________________________________ 51.44°N FreeBSD - The Power To Serve http://www.freebsd.org 2.057°W My Webpage http://ukug.uk.freebsd.org/~mark mailto:marko@freebsd.org http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message