The AWK Programming Language, 2nd Ed

Author: Alfred V. Aho, Brian W. Kernighan and Peter J. Weinberger
Publisher: Addison-Wesley
Pages: 240
ISBN: 978-0138269722
Print: 0138269726
Kindle: B0CCJ1N4X3
Audience: Developers interested in Awk
Rating: 5
Reviewer: Kay Ewbank

The name Brian Kernighan among the authors of this updated classic raises expectations as to the book's content, and it doesn't disappoint.

If anybody is in a position to write a definitive guide to Awk, it's Brian Kernighan, as he's one of the co-authors of the Unix tool - his surname supplied the K in the name. He's also been a major maintainer of the language until recently, finally handing over maintenance having worked on the most recent major update of Awk to add support for UTF-8 encoded text and CSV files.

Banner

To reflect the changes, he and his co-authors have updated this classic book that was last released in 1988. The new edition has been reorganized and covers the new features, with added material on data handling and exploration.

Awk is still popular partially because it's easy to learn, and is always available on UNIX, Linux, MacOS and usually on Windows. Kernighan describes it as a language that lets you write something in a short program, often in a single line of code, because Awk handles the 'baggage' that you need in other languages.

 

The book opens with an Awk tutorial that introduces the main commands and examples showing how Awk is used. This is further explored in the next chapter, Awk in action, which looks at selections, transformations, summarizations, and setting up a database.

A chapter on exploratory data analysis uses accessible examples including an analysis of passenger mortality data from the sinking of the Titanic; and working with a large dataset in the form of the beer ratings from RateBeer.

Data processing is covered next, with sections on data transformation and reduction, validation, and handling multiline records. A chapter on reports and databases then goes on and covers the use of packaged queries and reports.

A chapter on processing words looks at using Awk for the manipulation of natural language text; not an obvious use, but the examples include programs that generate words and phrases, carry on limited dialogs with users, and so on. The authors acknowledge that the examples are toys, but point out that some of the document preparation programs are in regular use.

Chapter 7 is titled 'Little Languages', and looks at the use of Awk to develop translators for languages for specific applications such as an assembler, interpreter, and calculators. The examples include a sort generator, reverse-polish calculator, and recursive-descent parsers for arithmetic expressions and a subset of Awk.

A chapter on 'experiments with algorithms' comes next with sections on sorting, profiling and topological sorting. There's also an extended example looking at Make, a file updating program.

The final chapter of the book considers Awk as a language, its history, and its strengths and weaknesses.

Overall, this is a well written, informative and authoritative book. Awk is a useful tool that is widely available, and this book tells you all you need to know.

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


PHP In Easy Steps, 4th Ed

Author: Mike McGrath
Publisher: In Easy Steps
Date: April 2021
Pages: 192
ISBN: 978-1840789232
Print: 1840789239
Kindle: B08ZSV3MNH
Audience: People wanting to learn PHP
Rating: 4
Reviewer: Ian Elliot
PHP isn't a fashionable language, but this doesn't mean it isn't worth learning.



Functional Programming in C#, 2nd Ed (Manning)

Author: Enrico Buonanno
Publisher: Manning
Date: February 2022
Pages: 448
ISBN: 978-1617299827
Print: 1617299820
Kindle: B09P1Z2PPB
Audience: C# developers
Rating: 5
Reviewer: Mike James
Is C# a good language for functional programming?


More Reviews