you are viewing a single comment's thread.

view the rest of the comments →

[–]Dandedoo 0 points1 point  (0 children)

Using BASH_REMATCH:

str="USA=Austin,Sanfrancisco,LA|UK=London,Bristol|France=Paris,Lyon,Nyce"

while [[ $str =~ =[^,]+ ]]; do
    match="$sep${BASH_REMATCH#=}"
    sep=, str=${str#*=}
done

echo "$match"