define awk function
The last three lines show you how to define your own awk function. The format is simple -- type function, then the function name, and then the parameters separated by commas, inside parentheses. After this, a { } code block contains the code that you'd like this function to execute.