I have declared a variable: username=user2
the contents of the test json is as follows: { "name": "user1", "city": "Texas" }
I would like to replace the value of name i.e user1 with a variable username I tried the following command: sed -i 's/"name": "user1"/"name": $username/g'
The output was:
{ "name": $username, "city": "Texas" }
Expected Output is:
{ "name": "user2", "city": "Texas" }
How can this be achieved? Thanks in Advance