The Hello world example is as simple as:
awk 'BEGIN {print "Hello world"}'
The most basic awk
program consists of a true value (typically 1
) and makes awk
echo its input:
$ date | awk '1'
Mon Jul 25 11:12:05 CEST 2016
Since "hello world" is also a true value, you could also say:
$ date | awk '"hello world"'
Mon Jul 25 11:12:05 CEST 2016
However, your intention becomes much clearer if you write
$ date | awk '{print}'
Mon Jul 25 11:12:05 CEST 2016
instead.