From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4300 invoked by alias); 3 Dec 2015 16:28:20 -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: 21036 Received: (qmail 21097 invoked from network); 3 Dec 2015 16:28:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f4-f79026d00000418a-12-56606b43e9a1 Date: Thu, 03 Dec 2015 16:18:08 +0000 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: Mapping split ${(s::)...} across an array Message-id: <20151203161808.574b2486@pwslap01u.europe.root.pri> In-reply-to: <151203080008.ZM11091@torch.brasslantern.com> References: <151203080008.ZM11091@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsVy+t/xy7rO2QlhBv1ztS12nFzJ6MDoserg B6YAxigum5TUnMyy1CJ9uwSujGV/z7MVXOKsuNX+nr2B8QZ7FyMnh4SAicSuXbPYIGwxiQv3 1gPZXBxCAksZJbZe38EM4Uxjkjj3/gUrhHOaUWLB7E1QzhlGiZ0HZjOB9LMIqErsWbWbGcRm EzCUmLppNiOILSIgKrF8xWawfcICZhKd/RfBangF7CX+zt8OZHNwcApYSTz6kAISFhKwlDjW dgmshF9AX+Lq309MEOfZS8y8coYRolVQ4sfkeywgNrOAlsTmbU2sELa8xOY1b5kh5qhL3Li7 m30Co/AsJC2zkLTMQtKygJF5FaNoamlyQXFSeq6hXnFibnFpXrpecn7uJkZIOH/Zwbj4mNUh RgEORiUeXgHP+DAh1sSy4srcQ4wSHMxKIrxRbglhQrwpiZVVqUX58UWlOanFhxilOViUxHnn 7nofIiSQnliSmp2aWpBaBJNl4uCUamA0eMdp/eTIVl/PtHkSPou8Yywle/W3XOE9UfjZnn2H C8fGggcuX6MWzN7WMCsvRUo7a9ZT/dKCzcflkhxKarc/Kw9duy4u+s7SzsfbpN0/pW5p5pzi /jDp8Ok8nYOTp5xY8GV7jYjDm2Wr3q+QlUu87fU8Ymuuk+OWrkdbhDJu7Y669T/vQoy6Ektx RqKhFnNRcSIAvcQQO2MCAAA= On Thu, 03 Dec 2015 08:00:08 -0800 Bart Schaefer wrote: > I recently had a situation where I wanted to create a new array by splitting > every element of an existing array. The only solution I came up with was > to first join the original array into a string using the same character I > wanted to use to split the individual elements. > > Is there another way? :s// and similar replacements are mapped across an > array by definition, but that doesn't help (does it?). I think the normal split logic currently always implies joining first and always has done, though I don't remember the original rationale. I guess we could add a "_" flag to change this. (I was wondering if we could do the parsing of that -- currently unused --- in a slightly more flexible manner, but I've forgotten quite what I was thinking...) (z) doesn't, but you are constrained to use normal word splitting, and I think this is at the level below IFS is relevant. But if you can arrange to use space as the character, and arrage to quote it elsewhere (you have quoting problems with any split character) that might be a possibility. There are other possible hacks if you can use white space. pws