I need to perform the absolute value calculation a lot in awk.
But absolute value is not built into awk, so many of my awk commands look like this:
awk 'function abs(x){return ((x < 0.0) ? -x : x)} { ...calls to "abs" .... }' file
Is there a way to store user-defined awk functions in files, and have awk automatically load these functions whenever it is called?
Something like setting an awk "include" path or user-profile, much the same way you do for bash and other programs.
@include "file"to import files.awktoawk -i funcs.awk