From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2621 invoked by alias); 26 Mar 2011 01:37:56 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15900 Received: (qmail 8873 invoked from network); 26 Mar 2011 01:37:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at myproxylists.com designates 217.119.39.74 as permitted sender) X-Originating-IP: 127.0.0.1 Message-ID: <9cf85fb41e83cdaa17ad01277e478571.squirrel@gameframe.net> In-Reply-To: <110325150350.ZM30913@torch.brasslantern.com> References: <9861b13e6828d43041a5b489f016664a.squirrel@gameframe.net> <110325150350.ZM30913@torch.brasslantern.com> Date: Sat, 26 Mar 2011 03:37:42 +0200 Subject: Re: How to add string to end of each array element without loops From: nix@myproxylists.com To: "Bart Schaefer" Cc: zsh-users@zsh.org User-Agent: SquirrelMail/1.4.20 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal > On Mar 25, 11:32pm, nix@myproxylists.com wrote: > } Subject: How to add string to end of each array element without loops > } > } a=(1 2 3) > } a=(foo$^a[@]) > } > } print -l "${(@n)a}" > > If $^a[@] works, then you don't need the subscript, either: > > a=(foo$^a) > > Futhermore you don't need the quotes and (@) in the print expression: > > print -l ${(n)a} > > } foo1 > } foo2 > } foo3 > } > } I would like to get the following output instead: > } > } 1foo > } 2foo > } 3foo > > I'm not understanding what you're asking. Either this is as easy as > > a=(1 2 3) > a=(${^a}foo) # braces needed to distinguish $a from $afoo > > or you've already got (foo$^a) and you're asking how to change "foo?" > into "?foo" for the whole array > > setopt extendedglob > a=(${a/(#b)foo(<->)/$match[1]foo}) > > or you mean something else entirely. Can you elaborate? > > -- > 10.0.0.1 10.127.255.254 > On 25 March 2011 22:32, wrote: >> a=(1 2 3) >> a=(foo$^a[@]) >> >> print -l "${(@n)a}" >> >> foo1 >> foo2 >> foo3 >> >> I would like to get the following output instead: >> >> 1foo >> 2foo >> 3foo > > a=(${^a}foo) ? > > -- > Mikael Magnusson > I wanted to append word 'foo' to end of each element in an array and Mikael's solution did it. Now however, im getting a segfault when an array elements exceeds over 4 million elements even there are enough RAM in my box. Is there a way to increase this limit? There was nothing to that with 'limit' command.