the following script will only run the BEGIN and END blocks:
#!/bin/awk -f
BEGIN {print "Hello, World!"}
{ print "Don't Panic" }
END { print "and we're panicking... I told you not to panic. Did you miss that part?" }
and the output is:
$ awk -f joint.awk .
Hello, World!
and we're panicking... I told you not to panic. Did you miss that part?
the expected output is:
$ awk -f joint.awk .
Hello, World!
Don't panic
and we're panicking... I told you not to panic. Did you miss that part?
what's odd is that when I change the middle block to print $1
, instead of printing a piece of text, it runs as expected when I pass a file in.