From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5626 invoked from network); 13 Apr 2004 17:16:52 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Apr 2004 17:16:52 -0000 Received: (qmail 5827 invoked by alias); 13 Apr 2004 17:16:24 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7343 Received: (qmail 5782 invoked from network); 13 Apr 2004 17:16:24 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 13 Apr 2004 17:16:24 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 13 Apr 2004 17:16:24 -0000 Received: (qmail 11874 invoked from network); 13 Apr 2004 17:16:23 -0000 Received: from madrid10.amenworld.com (62.193.203.32) by a.mx.sunsite.dk with SMTP; 13 Apr 2004 17:16:22 -0000 Received: from DervishD.pleyades.net (212.Red-80-35-44.pooles.rima-tde.net [80.35.44.212]) by madrid10.amenworld.com (8.10.2/8.10.2) with ESMTP id i3DHGHh03654; Tue, 13 Apr 2004 19:16:17 +0200 Received: from raul@pleyades.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <1BDRUh-00012O-00>; Tue, 13 Apr 2004 19:14:43 +0200 Date: Tue, 13 Apr 2004 19:14:43 +0200 From: DervishD To: Bart Schaefer Cc: Zsh Users Subject: Re: Subscripting without temporaries Message-ID: <20040413171443.GA3850@DervishD> Mail-Followup-To: Bart Schaefer , Zsh Users References: <20040413120053.GA4420@DervishD> <040413082948.ZM20696@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <040413082948.ZM20696@candle.brasslantern.com> User-Agent: Mutt/1.4.2.1i Organization: Pleyades X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Hi Bart :) * Bart Schaefer dixit: > > I have an array containing strings of this type, one per 'slot': > > "Some text [particular text] Another text" > > For each line I want to be able to separate the three parts: the > > 'Some text', the '[Particular text]', and the 'Another text'. > > Which is the zsh-cool-way of doing the same? > However, as you can treat strings as arrays and index them by character, > and also do slices with pairs of indices: OK, but then I need a temporary... Before the backreference trick I tried the same using more or less what you suggests below, but I didn't get far because I cannot do $array[EXP][Whatever] (well, namely I was trying ${array[10]}[1,8], but zsh told me 'no matches found'). > txt="Some text [particular text] Another text" > print -l $txt[1,$txt[(i)\[]-2] $txt[(r)\[,(R)\]] $txt[$txt[(I)\]]+2,-1] How can I do the same without the temporary? I mean, without assigning to 'txt' or whatever the name of the temporary the result of $array[EXP] Thanks for your help :) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/