Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

215
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda