Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR2613: Quick Awk Tip

Hosted by Klaatu on 2018-08-08 00:00:00
Download or Listen

This is obvious, but it tripped me up a few times after listening to the excellent Awk series by Dave and B-yeezi, so I though I'd share it here to save others the trouble.

When moving from simple awk commands to proper awk scripts, you put a shebang line at the top of your script. It's pretty common to many of us, because we do it for Python and Bash all the time.

But if you just put:

#!/usr/bin/awk

Then your awk script won't work the way you expect.

You must provide the -f flag:

#!/usr/bin/awk -f

Now you can pipe things to your awk script as expected.

Comments



More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.