21.07.2015 Views

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

282 <strong>G<strong>AWK</strong></strong>: <strong>Effective</strong> <strong>AWK</strong> <strong>Programming</strong>mawkawkaCompressed tar filehttp://www.cs.princeton.edu/~bwk/btl.mirror/awk.tar.gzZip filehttp://www.cs.princeton.edu/~bwk/btl.mirror/awk.zipThis version requires an ISO C (1990 standard) compiler; the C compiler fromGCC (the GNU Compiler Collection) works quite nicely.See Section A.4 [Extensions in the Bell Laboratories awk], page 259, for a listof extensions in this awk that are not in POSIX awk.Michael Brennan has written an independent implementation of awk, calledmawk. It is available under the GPL (see [GNU General Public License],page 316), just as gawk is.The original distribution site for the mawk source code no longer has it. A copyhas been made available at http://www.skeeve.com/gawk/mawk1.3.3.tar.gz.In 2009, Thomas Dickey took on mawk maintenance. Basic informationis availabe on the project’s web page. The download URL isftp://invisible-island.net/mawk/mawk.tar.gz.Once you have it, gunzip may be used to decompress this file. Installationis similar to gawk’s (see Section B.2 [Compiling and Installing gawk on Unix],page 268).mawk has the following extensions that are not in POSIX awk:• The fflush built-in function for flushing buffered output (see Section 8.1.4[Input/Output Functions], page 143).• The ‘**’ and ‘**=’ operators (see Section 5.5 [Arithmetic Operators],page 81 and also see Section 5.7 [Assignment Expressions], page 83).• The use of func as an abbreviation for function (see Section 8.2.1 [FunctionDefinition Syntax], page 153).• The ‘\x’ escape sequence (see Section 2.2 [Escape Sequences], page 25).• The ‘/dev/stdout’, and ‘/dev/stderr’ special files (see Section 4.7 [SpecialFile Names in gawk], page 69). Use "-" instead of "/dev/stdin" withmawk.• The ability for FS and for the third argument to split to be null strings(see Section 3.5.2 [Making Each Character a Separate Field], page 45).• The ability to delete all of an array at once with ‘delete array’ (seeSection 7.6 [The delete Statement], page 123).• The ability for RS to be a regexp (see Section 3.1 [How Input Is Split intoRecords], page 36).• The BINMODE special variable for non-Unix operating systems (seeSection B.3.1.4 [Using gawk on PC Operating Systems], page 273).• The nextfile statement (see Section 6.4.9 [Using gawk’s nextfile Statement],page 109).Written by Andrew Sumner, awka translates awk programs into C, compilesthem, and links them with a library of functions that provides the core awkfunctionality. It also has a number of extensions.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!