Suppose there is a string named as (ai-somename-someid) and it is stored in say
$x='ai-somename-someid'
Now I want to extract (somename)from the given string and pass it into another variable by using split(I am using the below script)
$y = $x.split("-")
$y
It is giving me the output as
ai
somename
someid
but I would like to have only
somename
as the output.