Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
sed command not searching for string correctly and replacing

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?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

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.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda