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

Re: extraction of a string from one another



Well, there are several ways. For instance, you can split on slashes, then join back just the first three components:

zsh% h=http://www.try.org/examples/easy
zsh% a=("${(@s[/])h}")
zsh% print "${(j[/])a[1,3]}"

http://www.try.org


On Sat, Dec 7, 2024 at 11:17 PM aegy <aegy@xxxxxxx> wrote:
Hi,

h=http://www.try.org/examples/easy

how can I obtain  http://www.try.org from $h ?

thanks,
guido



--
Mark J. Reed <markjreed@xxxxxxxxx>


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