From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 8 20:55:53 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 617F216A47C for ; Fri, 8 Feb 2008 20:55:53 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outA.internet-mail-service.net (outA.internet-mail-service.net [216.240.47.224]) by mx1.freebsd.org (Postfix) with ESMTP id 45D8313C461 for ; Fri, 8 Feb 2008 20:55:53 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Fri, 08 Feb 2008 12:55:52 -0800 Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id 8AC5412715B; Fri, 8 Feb 2008 12:55:51 -0800 (PST) Message-ID: <47ACC1DD.8010105@elischer.org> Date: Fri, 08 Feb 2008 12:55:57 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= References: <86prv7agit.fsf@ds4.des.no> In-Reply-To: <86prv7agit.fsf@ds4.des.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 20:55:53 -0000 Dag-Erling Smørgrav 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) > > 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" the symbol for end of file is $ so 1,$ > > 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 :g/pattern/s//replacement/g :1,$s/patter/replacement/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