Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: splitting and assigning



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