I know there is tons of material on this online but I could not solve my problem with the information found, hence this question.
This is what I have in my bash script:
value=$(cat <<-EOT
{
"file_path": "/text1/text2/logs/example.log",
"log_group_name": "/text3/text4/example.log",
"log_stream_name": "{hostname}"
},
EOT
)
#value='sed sucks'
#echo $value
sed -i "s#app_log_files#${value}#" ex1.json
ex1.json has code like this
"collect_list": [
app_log_files
{
"file_path": "/text5/text6/messages",
"log_group_name":"/text7/text8/messages",
"log_stream_name":"{hostname}"
},
I think the problem is with ${value} having space, forward slash, comma, quotes. I tried using different delimiters and that did not work. Strangely I am seeing "sed: -e expression #1, char 17: unterminated `s' command" error even though I have closing delimiter in my sed.
Is sed right thing for usage here? Any suggestions or ideas on where I am going wrong. Thanks for help in advance.