Naming Awk

The Awk programming language was named after the initials of its creators. In the preface to a book that just came out, The AWK Programing Language, Second Edition, the authors give a little background on this. Naming a language after its creators shows a certain paucity of imagination. In our defense, we didn’t have a […]

Awk regular expressions

These notes describe awk’s regular expression flavor. Awk supports POSIX extended regular expressions (ERE). From the perspective of someone like myself accustomed to Perl-compatible regular expressions (PCRE), “extended” regular expressions are restricted regular expressions, and POSIX “basic” regular expressions (BRE) are restricted regular expressions requiring a lot of extra backslashes. What works I believe gawk […]

Arbitrary precision math in gawk

The idea of using awk for any math beyond basic arithmetic is kinda strange, and yet it has some nice features. Awk was designed for file munging, a task it does well with compact syntax. GNU awk (gawk) supports the original minimalist version of awk and adds more features. It supports arbitrary precision arithmetic by […]

Telescopes, awk, and learning

Here’s a quote I think about often: “It is faster to make a four-inch mirror and then a six-inch mirror than to make a six-inch mirror.” — Bill McKeenan, Thompson’s law of telescopes If your goal is to make a six-inch mirror, why make a four-inch mirror first? From a reductionist perspective this makes no […]

The awkward middle child of algebra

Abstract algebra is basically the study of groups, rings, and fields. There are more concepts, but these are the big three. Groups have the least structure and fields have the most structure. Rings are somewhere in the middle. Groups have just one operation, which is thought of as multiplication by default. If the group operation […]

More than sed and awk

I’m going to expand the content of my SedAwkTip twitter account. I’ve covered the most commonly used features of sed and awk, and rather than go into more advanced/obscure features of these languages, I’m going to add tips on other common command line software. I’ll probably change the name of the account to reflect the […]

Awk one-liners

Peteris Krumins has written a fine little book Awk One-Liners Explained. It’s just 58 pages, and it’s an easy read. As I commented here, I typically try to master the languages I use. But for some languages, like awk and sed, it makes sense to learn just a small, powerful subset. (The larger a language […]

A little Awk

Greg Grothaus posted an article today entitled Why you should learn just a little Awk. The article recommends taking a few minutes to learn only the most basic parts of the Awk language. I find this interesting for several reasons. First, it is impressive what you can accomplish with just a few keystrokes in Awk. […]

Natural one-liners

I learned to use Unix in college—this was before Linux—but it felt a little mysterious. Clearly it was developed by really smart people, but what were the problems that motivated their design choices? Some of these are widely repeated. For example, commands have terse names because you may have to transmit commands over a glacial […]

Unix linguistics

If you knew that you wanted to learn 10 spoken languages, it would probably be helpful to take a course in linguistics first. Or maybe to have a linguistics course after learning your first or second language. And if the languages are related, it would help to know something about the linguistics of that group […]