I'm currently deploying a new webapp (GEM) for a project. When updating the user data, it's not correctly searching for the string and replacing it in the workers.properties file in apache. The current script I'm using to do this is:
sed -i "s/worker.list\=GMA,jkstatus/worker.list\=GMA,ETL,common-resource,GAA,authzmanager,Launch,jkstatus/g" ${INSTALL_BASE}/${APACHE_DIR}/conf/jk/workers.properties
the current line of code needing changed in workers.properties is the following:
worker.list=GMA,ETL,common-resource,GAA,authzmanager,Launch,jkstatus
The change im trying to make is just this:
worker.list=GMA,ETL,common-resource,GAA,GEM,authzmanager,Launch,jkstatus
Is there something not right in the search? It's changing other things in the file, so it's definitely able to access workers.properties. Any help on this is appreciated.
EDIT: I have confirmed that it does not like the comma in between GMA,jkstatus indicating to start at GMA and end at jkstatus:
\=GMA,jkstatus/ So how do I tell sed to stop on jkstatus instead of using a comma?
You can match any text after worker.list= using worker\.list=.*:
sed -i 's/worker\.list=.*/worker.list=GMA,ETL,common-resource,GAA,authzmanager,Launch,jkstatus/' ${INSTALL_BASE}/${APACHE_DIR}/conf/jk/workers.properties
To remove only the first occurrence in the file you may use
sed -i '0,/worker\.list=.*/s//worker.list=GMA,ETL,common-resource,GAA,authzmanager,Launch,jkstatus/' ${INSTALL_BASE}/${APACHE_DIR}/conf/jk/workers.properties
Note 0,/pattern/ will remove only the first occurrence in the file.