Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: splitting and assigning
- X-seq: zsh-workers 32618
- From: Christian Neukirchen <chneukirchen@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: splitting and assigning
- Date: Sat, 24 May 2014 17:00:49 +0200
- In-reply-to: <20140524054323.GB4047__20662.9173866988$1400911201$gmane$org@solfire> (meino cramer's message of "Sat, 24 May 2014 07:43:23 +0200")
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20140524054323.GB4047__20662.9173866988$1400911201$gmane$org@solfire>
- Sender: chris@juno
meino.cramer@xxxxxx 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 <chneukirchen@xxxxxxxxx> http://chneukirchen.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author