Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Splitting $foo on delimiter value
- X-seq: zsh-users 3006
- From: Oliver Kiddle <opk@xxxxxxxxxxxxx>
- To: Allen Belk <allen.belk@xxxxxxx>
- Subject: Re: Splitting $foo on delimiter value
- Date: Mon, 03 Apr 2000 15:42:36 +0100
- Cc: zsh-users@xxxxxxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <000501bf9d78$ec3313f0$3e525f83@xxxxxxxxxxx>
Allen Belk wrote:
> I am looking for the appropriate method of splitting a string at a set
> delimiter.
>
> foo=red:white:blue
>
> I want to seperate these into 3 fields much the way the unix cut command
> would as in:
Try using ${(s.:.)foo}. That should split it on colons.
If you want to write it in a way that is compatible with sh or ksh, you
can stick : in $IFS.
Oliver Kiddle
Messages sorted by:
Reverse Date,
Date,
Thread,
Author