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

290
Vistas
Why does echo 'hello world' | awk '/hello\s/ {print $0}' produce nothing?

Why does this 'awk' command produce nothing?

   echo 'hello world' | awk '/hello\s/ {print $0}'

I suppose the pattern /hello\s/ should match any line that has 'hello' followed by a whitespace, right?

For info, I am using awk in a Mac OS. The awk version is 20070501.

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

0

This works on OS X:

echo 'hello world' | awk '/hello[[:space:]]/ {print $0}'

As mentioned in the gawk docs (paraphrasing):

Think of \s like shorthand for [[:space:]]

You can also use [[:blank:]] to limit to space and tab only.

Having trouble finding some 'plain' awk docs. This seems legit, despite the name of the page.

over 4 years ago · Santiago Trujillo Denunciar

0

echo 'hello world' | awk  '/^hello / {print $0}'

This looks for every line that starts with "hello "

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