...
tomcat.javaoptions=-Djava.net.preferIPv4Stack\=true \
-Djava.net.preferIPv6Addresses\=false \
-Dcom.sun.management.jmxremote.port\=12345 \
-Djava.rmi.server.hostname=${application.hostname}
...
I need add new line to the end of tomcat.javaoptions with sed. I have to use regex, because I do not know how java options will look originally. i know only that it starts from tomcat.javaoptions=
and can have multiple lines. Any idea?
EDITED: I need to add new line
...
tomcat.javaoptions=-Djava.net.preferIPv4Stack\=true \
-Djava.net.preferIPv6Addresses\=false \
-Dcom.sun.management.jmxremote.port\=12345 \
-Djava.rmi.server.hostname=${application.hostname} \
-agentpath:/opt/agent/agent.so,name=agent
...
I tried it just to add only "-agentpath" but no luck
sed -i "/^tomcat.javaoptions=(.*/n*)*/s/$/ \\\\\n -agentpath/g" file