From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23247 invoked from network); 16 Aug 2005 16:18:36 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 16 Aug 2005 16:18:36 -0000 Received: (qmail 75862 invoked from network); 16 Aug 2005 16:18:30 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 16 Aug 2005 16:18:30 -0000 Received: (qmail 16404 invoked by alias); 16 Aug 2005 16:18:23 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9323 Received: (qmail 16394 invoked from network); 16 Aug 2005 16:18:22 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 16 Aug 2005 16:18:22 -0000 Received: (qmail 74747 invoked from network); 16 Aug 2005 16:18:22 -0000 Received: from jlefevre.net1.nerim.net (HELO ay.vinc17.org) (80.65.226.245) by a.mx.sunsite.dk with SMTP; 16 Aug 2005 16:18:15 -0000 Received: from lefevre by ay.vinc17.org with local (Exim 4.52) id 1E548l-0000Py-0B; Tue, 16 Aug 2005 18:18:15 +0200 Date: Tue, 16 Aug 2005 18:18:14 +0200 From: Vincent Lefevre To: Zsh Users Subject: Re: Replacing sed for zsh portability Message-ID: <20050816161814.GA10992@ay.vinc17.org> Mail-Followup-To: Zsh Users References: <20050815103557.GA1411@DervishD> <20050816154033.GY10992@ay.vinc17.org> <20050816155114.GA1854@DervishD> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20050816155114.GA1854@DervishD> X-Mailer-Info: http://www.vinc17.org/mutt/ User-Agent: Mutt/1.5.10-vl-20050813i X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 On 2005-08-16 17:51:14 +0200, DervishD wrote: > The thing is perfectly suitable to be done in sed, in fact it is > a one-liner (three lines if non-GNU sed), and it can even be done in > one or two lines in Zsh. Introducing a dependency with Perl just for [...] The problem with sed is that it is non-portable, and it is difficult to be sure that a sed call will work as expected on any machine. With zsh, things related to regexp are difficult to read, and the behaviour often depends on options (one needs to remember to use "emulate -LR zsh", and this should be OK, however). I've had to switch to Perl for a simple replacement just because in-place editing with sed isn't supported everywhere, and when it is supported, it doesn't behave in the same way on every machine. Though this is in a zsh function, I haven't tried with zsh. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / SPACES project at LORIA