bash gawk mawk - ghdrako/doc_snipets GitHub Wiki

extensions in Gawk:

  • Namespaces—Once Awk offered user-defined functions, this Gawk extension allowed even more sharing and growth. As in C++ or Java, namespaces in Awk prevent clashes between function names or other symbols defined in different functions.

  • BEGINFILE and ENDFILE—Awk provides BEGIN and END actions to let you do initial processing (before all files are read) and terminal processing (after all files are read). Gawk extends this with BEGINFILE and ENDFILE, which let specify actions to take before reading or after processing each file in a set of multiple files.

  • Two-way pipelines—These streamline the operation of coprocesses, which allow you to delegate operations to a separate program and get results back. This form of multiprocessing has been around in other languages for quite a while, most notably in Go. The original form of Awk allowed coprocesses, but only through the cumbersome use of temporary files.

  • Network programming—This capability takes multiprocessing past the local system, using classic internet sockets to communicate with programs on remote hosts. The remote programs could be coded in any language, not just Awk.

  • Arbitrary-precision arithmetic—Like multi-dimensional arrays, this feature appeals to scientists who need to go beyond the limitations of conventional integers and floating-point numbers, constrained by microprocessor design.

  • Plugins/extensions—These allow intrepid programmers to extend Gawk without messing around in the core code.