From owner-freebsd-questions@FreeBSD.ORG Thu Dec 17 04:04:34 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A746E106566B for ; Thu, 17 Dec 2009 04:04:34 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 596A68FC0C for ; Thu, 17 Dec 2009 04:04:34 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.3/8.14.3) with ESMTP id nBH44Sej098855; Wed, 16 Dec 2009 21:04:28 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.3/8.14.3/Submit) with ESMTP id nBH44Sln098852; Wed, 16 Dec 2009 21:04:28 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Wed, 16 Dec 2009 21:04:28 -0700 (MST) From: Warren Block To: Martin McCormick In-Reply-To: <200912170320.nBH3KatB081365@dc.cis.okstate.edu> Message-ID: References: <200912170320.nBH3KatB081365@dc.cis.okstate.edu> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (wonkity.com [127.0.0.1]); Wed, 16 Dec 2009 21:04:28 -0700 (MST) Cc: freebsd-questions@freebsd.org Subject: Re: sed -f Script Syntax X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2009 04:04:34 -0000 On Wed, 16 Dec 2009, Martin McCormick wrote: > Warren Block writes: >> sed(1) says it should be -E. Looks like it will only work on the whole >> script. > > Many thanks. I have had -e work many times But -e does not mean what you think here: -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BREs). The re_format(7) manual page fully describes both formats. -e command Append the editing commands specified by the command argument to the list of commands. So sed -E means "interpret regular expressions as extended" and -e is followed by a command: sed -E -e 's/a/b/' -e 's/x/y/' > if you call sed from either the command line or a shell script as in > > sed -f somefile > > with somefile being 1 or more lines of sed commands. When the > file itself is the script, the first line actually calls sed > from within the file. I'm not clear on why you want to do it that way instead of simply calling sed from a shell script, but sed -Ef seems to do what you want. -Warren Block * Rapid City, South Dakota USA