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.
This works on OS X:
echo 'hello world' | awk '/hello[[:space:]]/ {print $0}'
As mentioned in the gawk docs (paraphrasing):
Think of
\slike 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.
echo 'hello world' | awk '/^hello / {print $0}'
This looks for every line that starts with "hello "