From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 8 21:18:10 2008 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7026316A41A for ; Fri, 8 Feb 2008 21:18:10 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 029A413C448 for ; Fri, 8 Feb 2008 21:18:09 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c220-239-20-82.belrs4.nsw.optusnet.com.au [220.239.20.82]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m18LI3hw003359 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Feb 2008 08:18:04 +1100 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.2/8.14.1) with ESMTP id m18LI20K087749; Sat, 9 Feb 2008 08:18:02 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.2/8.14.2/Submit) id m18LI2NY087748; Sat, 9 Feb 2008 08:18:02 +1100 (EST) (envelope-from peter) Date: Sat, 9 Feb 2008 08:18:02 +1100 From: Peter Jeremy To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Message-ID: <20080208211802.GJ4008@server.vk2pj.dyndns.org> References: <86prv7agit.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="m46qSNjkc66Ye11q" Content-Disposition: inline In-Reply-To: <86prv7agit.fsf@ds4.des.no> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.17 (2007-11-01) Cc: hackers@freebsd.org Subject: Re: nvi strangeness X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2008 21:18:10 -0000 --m46qSNjkc66Ye11q Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 08, 2008 at 11:28:42AM +0100, Dag-Erling Sm=F8rgrav wrote: >As everybody knows, the ex/vi command for regexp substitution is > > [range] s[ubstitute] [/pattern/replace/] [options] [count] [flags] > >The man page does not document the syntax for ranges (nor for offsets or >counts for that matter) It definitely would be nice if vi(1) documented the various [foo] terms it uses and included explicit pointers to /usr/share/doc/{12.vi,13.viref} instead of just hinting that they exist. >Assuming the syntax is the same as for ed / sed, the following should >replace every occurrence of the word wait with the word delta: > >:,s/\/delta/g > >where "," means "the entire file" Actually, ',s/foo/bar/' is illegal in sed ('s/foo/bar/' means every line). That means the same syntax means three different things in three different editors. >I would really like nvi to understand ed-like ranges, and vi(1) to >either document this or cross-reference ed(1). Given that a bare comma means different things in ed and vi, I don't think that the meanings can be aligned because it would cause too much pain. Comparing the various behaviours, IMHO, the ed ',s/foo/bar/' behaviour is the anomoly: In vi, a null address in a range is the current line ('.' in ed). In both ed and sed, a null address in a range is illegal, except that two null addresses in ed refer to the entire file. --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. --m46qSNjkc66Ye11q Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHrMcK/opHv/APuIcRAmVEAJ96gAZ7Qie/QSXv4TsLRH0B6PnoEACeMswq 3u9/P01/gVmWFASwq1dYRiY= =U/tz -----END PGP SIGNATURE----- --m46qSNjkc66Ye11q--