Sureshchandra Jarugula Sureshchandra Jarugula - 22 days ago 16
Bash Question

separate two stings with double quotes

In my script the string value is coming like below

QUEUE_VALUE=ABC:CDE


I need output is
"ABC","CDE"


I tried with below command, I am getting output as
ABC","CDE


echo ${QUEUE_NAME} | sed s/:/\"\,\"\/g


Could you please help me, Is there any better command to use.

sat sat
Answer

You can try this sed:

$ echo $QUEUE_VALUE | sed -e 's/[^:]*/"&"/g' -e 's/:/,/g'
"ABC","CDE"
Comments