From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4616 invoked by alias); 24 May 2014 15:19:32 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32618 Received: (qmail 28932 invoked from network); 24 May 2014 15:19:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS, T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-workers@zsh.org From: Christian Neukirchen Subject: Re: splitting and assigning Date: Sat, 24 May 2014 17:00:49 +0200 Sender: chris@juno Message-ID: <8761kvql0e.fsf@gmail.com> References: <20140524054323.GB4047__20662.9173866988$1400911201$gmane$org@solfire> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dhcp-138-246-70-77.dynamic.eduroam.mwn.de In-Reply-To: <20140524054323.GB4047__20662.9173866988$1400911201$gmane$org@solfire> (meino cramer's message of "Sat, 24 May 2014 07:43:23 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) meino.cramer@gmx.de writes: > Hi, > > I have a looooooong list, whgich consists > of a 32 character long checksum (from md5sum), > two spaces and a absolute path with the checksummed file. > > I want to split each line into two parts: > the checksum and the path/file and assign each part > to a separate variable. > > I tried to put this into a one-liner and failed using > ${(s: :)line}. % line="955e8d4f67775385bbbc58b4b113d7b9 file name with spaces" % echo ${${(s: :)line}[1]} 955e8d4f67775385bbbc58b4b113d7b9 % echo ${${(s: :)line}[2]} file name with spaces -- Christian Neukirchen http://chneukirchen.org