Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

300
Views
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 answers
Answer question

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 Report

0

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

This looks for every line that starts with "hello "

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!