I need to replace some text in a file and add couple of lines before the end of file.
I have this:
{
"something": "option1",
"other": [
"value",
]
}
and I need this:
{
"something": "option2",
"other": [
"value",
],
"more": {
"stuff": "yey!"
}
}
I tried this scipt:
stuff=$1
value=",
\"more\": {
\"stuff\": \"$stuff\"
}"
sed -e "s/option1/option2" -e '$ \i$value' \
file1.json > file2.json
but I get:
{
"something": "option2",
"other": [
"value",
]
$value
}
How do I do this properly?