I am trying to insert a specific xml configuration inside a specific xml element in a configuration file with sed in a bash shell script. When using the sed command on one line, it works, but when the expression is on multiple lines, it does not.
I am trying to insert the xml configuration inside an element that is almost in the middle of the file, so I used the line to check the // \ nconfig / gi file of the file.xml sed file, and this works, but I need to add a lot more configuration, so the resulting sed command will be like this:
sed -i '
/broker/broker\n \
<plugins> \
<jaasAuthenticationPlugin configuration="activemq" /> \
<authorizationPlugin> \
<map> \
<authorizationMap> \
<authorizationEntries> \
<authorizationEntry topic=> read="admins" write="admins" admin="admins" /> \
<authorizationEntry queue=> read="admins" write="admins" admin="admins" /> \
</authorizationEntries> \
</authorizationMap> \
</map> \
</authorizationPlugin>
</plugins>/' $ACTIVEMQ_CONFIG
I originally wrote this as a document here in bash, but it turns out that the sed command itself needs a line continuation / continuation character, so it didn't help much with good code.
"unterminated address regex", , sed 's/pattern/replace/', . s/ sed, , s .
, , seds script, , sed script, script, script , , , , .
user2959896