Skip to content

Instantly share code, notes, and snippets.

@zfenj
Created May 11, 2019 19:07
Show Gist options
  • Save zfenj/30d6fe55de03823d87627fd23d8c60c4 to your computer and use it in GitHub Desktop.
Save zfenj/30d6fe55de03823d87627fd23d8c60c4 to your computer and use it in GitHub Desktop.
ZSH string manipulation: split string
# https://bougui505.github.io/2016/02/29/zsh_string_manipulation-_split_string.html
Split string in a given word separator (ws)
For example _:
# x="foo_1"
# echo $x[(ws:_:)1]
foo
# echo $x[(ws:_:)2]
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment