From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9180 invoked from network); 21 Mar 2006 14:55:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Mar 2006 14:55:01 -0000 Received: (qmail 21123 invoked from network); 21 Mar 2006 14:54:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Mar 2006 14:54:53 -0000 Received: (qmail 24881 invoked by alias); 21 Mar 2006 14:54:43 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10055 Received: (qmail 24871 invoked from network); 21 Mar 2006 14:54:42 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 21 Mar 2006 14:54:42 -0000 Received: (qmail 19470 invoked from network); 21 Mar 2006 14:54:42 -0000 Received: from happygiraffe.net (81.6.215.59) by a.mx.sunsite.dk with SMTP; 21 Mar 2006 14:54:40 -0000 Received: from localhost (localhost.happygiraffe.net [127.0.0.1]) by happygiraffe.net (Postfix) with ESMTP id CB442B84D; Tue, 21 Mar 2006 14:54:39 +0000 (GMT) Received: from happygiraffe.net ([127.0.0.1]) by localhost (gimli.happygiraffe.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 93429-03-3; Tue, 21 Mar 2006 14:54:39 +0000 (GMT) Received: by happygiraffe.net (Postfix, from userid 1001) id 882A3B84C; Tue, 21 Mar 2006 14:54:39 +0000 (GMT) Date: Tue, 21 Mar 2006 14:54:39 +0000 To: Marc Chantreux Cc: zsh-users@sunsite.dk Subject: Re: kinda perl split ... Message-ID: <20060321145439.GB93496@gimli.happygiraffe.net> References: <442002B4.8080501@ulpmm.u-strasbg.fr> <20060321135118.GA92936@gimli.happygiraffe.net> <44200C25.7020103@ulpmm.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44200C25.7020103@ulpmm.u-strasbg.fr> User-Agent: Mutt/1.5.11 From: dom@happygiraffe.net (Dominic Mitchell) X-Virus-Scanned: amavisd-new at happygiraffe.net On Tue, Mar 21, 2006 at 03:22:29PM +0100, Marc Chantreux wrote: > Dominic Mitchell wrote: > > > echo foo bar | while read a b junk > > do > > echo "a=$a b=$b" > > done > > so if the separator is ':', you should redefine IFS > > oldIFS=$IFS > IFS=':' > echo foo bar | while read a b junk > do > echo "a=$a b=$b" > done > IFS=$oldIFS > oldIFS= > > or with a subshell: > > ( IFS=':' > echo foo bar | while read a b junk > do > echo "a=$a b=$b" > done ) Or even simpler, just redefine the variable for that read command: echo foo:bar | while IFS=: read a b junk do echo "a=$a b=$b" done -Dom