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


Clean Craftsmanship

Author: Robert C. Martin
Publisher: Addison-Wesley
Date: November 2021
Pages: 416
ISBN: 978-0136915713
Print: 013691571X
Kindle:B095C16LSW
Audience: General
Rating: 4
Reviewer: Mike James
Well, I'm a clean craftsman - are you?



SQL Server 2022 Query Performance Tuning (Apress)

Author: Grant Fritchey
Publisher: Apress
Pages: 745
ISBN:978-1484288900
Print:1484288904
Kindle:B0BLYD98SQ
Audience: DBAs & SQL Devs
Rating: 4.7
Reviewer: Ian Stirk 

A popular performance tuning book gets updated for SQL Server 2022, how does it fare?


More Reviews