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

302
Vistas
How to grep a word inside xml files in a folder

I know I can use grep to find a word in all the files present in a folder like this

grep -rn core .

But my current directory has many sub-directories and I just want to search in all xml files present in the current directory and its all sub directories. How can I do that ?

I tried this

grep -rn core *.xml // Does not work

But it searches for xml files present in the current directory only. It does not do it recursively.

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

0

Try the --include option

grep -R --include="*.xml" "pattern" /path/to/dir

Reference: Grep Include Only *.txt File Pattern When Running Recursive Mode

over 4 years ago · Santiago Trujillo Denunciar

0

Use find:

find /path/to/dir -name '*.xml' -exec grep -H 'pattern' {} \;
over 4 years ago · Santiago Trujillo Denunciar

0

I use this often:

grep 'pattern' /path/to/dir/**/*.xml

EDIT:

with zsh

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