0

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"

1 Answer 1

1

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'

Sign up to request clarification or add additional context in comments.

2 Comments

it's not working, because I don't have a file, Team1, Team22,... are the string
@vero I don't understand. Where do you see a file in this command?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.