awk question

Quartz quartz at
Mon Oct 5 21:44:57 UTC 2015

> The form "input | step1 | step2 | step3 | step4>  result" usually
> is more readable

That's what I meant my being easier to understand conceptually. I agree 
about being more readable- even though this format sometimes needs the 
'useless cat' it's often my preferred coding style, especially in 
scripts where the input might change around.

> Additionally, awk isn't that hard to learn. Reading "man awk" will
> provide you with a good background. And if you're already a C
> programmer, you'll see that many things you can do in C will also
> work similarly in awk, which _might_ not even be a good thing. :-)

The problem with awk is the whole BEGIN/END/braces thing and how commas 
interact with the operands. It's not very much like sh or C syntax (or 
any other syntax) and new users tend to get really confused.

Also, different versions of awk handle math (esp floating point) with 
different rounding/precision/overflow, making calculations vary between 
installations, only further adding to the confusion.

More information about the freebsd-questions mailing list