the power of GNU Awk

Two alternative perspectives on GNU Awk (both from 1996):

"Ve are using ze GNU AWK" by Philip Greenspun:

"Relational databases and the World Wide Web: Automatic generation of hypertext based on reverse-engineered meta information." That sounded like it would be the best talk in the conference. I settled into my plastic chair in the plastic Holiday Inn conference room with high hopes. A young Austrian began to page through some Viewgraphs. "Ve are dumping ze database catalog tables out of ze Oracle system into Microsoft Access. Un dan, ve are using an AWK script to generate ze static files. Ze big challenge is making ze 6 character file names for some operating systems as can't have ze long file names."

A man raised his hand. I figured he was going to say "Why didn't you install Oracle WebServer and then get a 10-year-old to write three PL/SQL functions to extract the data from the RDBMS on the fly?" but instead he asked "Why did you use AWK instead of perl?"

The Austrian responded "AWK is the only language that I know."

Why GAWK for AI? [.txt version] by Ronald P. Loui:
Most people are surprised when I tell them what language we use in our undergraduate AI programming class. That's understandable. We use GAWK. GAWK, Gnu's version of Aho, Weinberger, and Kernighan's old pattern scanning language isn't even viewed as a programming language by most people. Like PERL and TCL, most prefer to view it as a "scripting language." It has no objects; it is not functional; it does no built-in logic programming. Their surprise turns to puzzlement when I confide that (a) while the students are allowed to use any language they want; (b) with a single exception, the best work consistently results from those working in GAWK. (footnote: The exception was a PASCAL programmer who is now an NSF graduate fellow getting a Ph.D. in mathematics at Harvard.) Programmers in C, C++, and LISP haven't even been close (we have not seen work in PROLOG or JAVA).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Do More

I side with the second article - I like the degree to which awk encourages simple, switch-case style programs. The fido like handling of external commands is cute, too. Overall, I can not recommend awk highly enough. I just wish the Linux kernel handled extended shebang lines (with more than one option group, like #!/bin/awk -F: -f) correctly (OS X and BSD can do it).

One may argue - and people do - that we should do it all in Perl, instead. Why is a bigger language better? Because you can "do more" - so learn the biggest language, and just forget about writing little programs that can be composed with other programs to make more programs!

cf "GAWK (GNU AWK) for AI?"

as discussed earlier on LTU...

(my brief foray into retro-AI was a software reimplementation, with this 1970's language, of a mind reading machine that Shannon had built — out of relays — in the 1950's)

bootstrapping

Another virtue of AWK is that it is comparatively easy to bootstrap from "raw iron".

Years later, we are arguably better at that (e.g. lua). Probably some of the current generation of concatenative languages will come up with similar simplicity. Maybe Kay's group will come up with one.

But AWK is a good example and an early example and, yes, it is a sweet spot for a lot of things.

-t