shell-script-to-add-new-line-to-existing-file
Budget: $10 – $30 USD
This post is hidden. You deleted this post just now.
This question already has answers here:
sed command to add a line after some pattern (6 answers)
Your post has been associated with a similar question. If this question doesn’t resolve your question, ask a new one.
Closed 2 mins ago.
I have a scenario where i need to insert a line in file using shell script
file content:
names = [
"victor-${env}/appname",
"steve-${env}/appname2",
"test-${env}/appname3"
]
there is a variable named 'appName' and value will be dynamic.
NOW, i will have to insert in >>> ( "test2-${env}/$appName", ) to file in any line between '[]'
Note: appName above is dynamic
I have tried sed command but its not picking up the dynamic value. sed -i '5i /$appName' file
expected file output:
names = [
"victor-${env}/appname",
"steve-${env}/appname2",
"test2-${env}/$appName",
"test-${env}/appname3"
]
This question already has answers here:
sed command to add a line after some pattern (6 answers)
Your post has been associated with a similar question. If this question doesn’t resolve your question, ask a new one.
Closed 2 mins ago.
I have a scenario where i need to insert a line in file using shell script
file content:
names = [
"victor-${env}/appname",
"steve-${env}/appname2",
"test-${env}/appname3"
]
there is a variable named 'appName' and value will be dynamic.
NOW, i will have to insert in >>> ( "test2-${env}/$appName", ) to file in any line between '[]'
Note: appName above is dynamic
I have tried sed command but its not picking up the dynamic value. sed -i '5i /$appName' file
expected file output:
names = [
"victor-${env}/appname",
"steve-${env}/appname2",
"test2-${env}/$appName",
"test-${env}/appname3"
]