vero
vero

Reputation: 1015

Concatenation String in shell

I have this shell line to concatenate 2 string:

 new_group="second result is: ${result},\"${policyActivite}_${policyApplication}\""

echo "result is: ${new_group}"

The result:

result is: "Team","Application_Team"

How can change the result to: result is: "Team, Application_Team"

Upvotes: 0

Views: 33

Answers (1)

oliv
oliv

Reputation: 13259

Use sed:

echo "$new_group"  | sed 's/"//g;s/^\(.*\)$/"\1"/'

The first statement is removing all double quotes. The second one add double at the start and the end of the line.

Alternatively, if you want to replace "," with ,, use this sed command: sed 's/","/, /g'

Upvotes: 1

Related Questions