Q:

how to sed for certain parts of a string by delimiter

I have lots of different strings that look like redhat-ubi-ubi7-7.8
I want to use the string to make variables so that I end up having something like
vendor=redhat
product=ubi
image=ubi7
tag=7.8

How can I do this?

A:

With bash and a here string:
string='redhat-ubi-ubi7-7.8'
IFS=- read -r vendor product image tag <<< "$string"
echo "$vendor"

Output:

redhat

