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

Splitting $foo on delimiter value



Zsh-users,
    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:

$ echo $foo | cut -d : -f 1
red
$ echo $foo | cut -d : -f 2
white
$ echo $foo | cut -d : -f 3
blue

I want to exploit zsh's internal features without having to use external
commands.  Any suggestions will be greatly appreciated.

Thanks,

Allen Belk

 | Allen Belk, Systems Manager
 | Office of Technology Resources
 | University of Southern Mississippi
 | allen.belk@xxxxxxx  601.266.6013





Messages sorted by: Reverse Date, Date, Thread, Author