From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 8 10:28:52 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 4F06216A417 for ; Fri, 8 Feb 2008 10:28:52 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 144C013C459 for ; Fri, 8 Feb 2008 10:28:52 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 6FA252083 for ; Fri, 8 Feb 2008 11:28:43 +0100 (CET) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: -0.3/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id DB4A9207F for ; Fri, 8 Feb 2008 11:28:42 +0100 (CET) Received: by ds4.des.no (Postfix, from userid 1001) id B4935844B6; Fri, 8 Feb 2008 11:28:42 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: hackers@freebsd.org Date: Fri, 08 Feb 2008 11:28:42 +0100 Message-ID: <86prv7agit.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: 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 10:28:52 -0000 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) 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" That doesn't work, however, and neither does "1,"; only "X,Y" works, so if you want to substitute in the entire file, you first have to find out how long it is, then manually type in that number. ...or you could use the following (courtesy of roberto@): :%s/\/delta/g None of this is documented anywhere. I would really like nvi to understand ed-like ranges, and vi(1) to either document this or cross-reference ed(1). Going off on a tangent, I wonder why the nvi license is reproduced in the man page, as it doesn't seem to require it, and no other man page includes the license of the program it describes (with a single exception: groff) DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no