awk, the Often Ignored Little Language

Many people use awk for one-liners; picking out fields from logs, doing pattern matching. It’s capable of so much more however. IMO, the “littleness” of the language is one of it’s strengths.

Over a decade ago while commuting on a train to a customer site, I was amazed at the number of people working on sudoku puzzles. (Cell phones weren’t as “smart” back then, so they couldn’t play games or check Facebook the way they do on the train today.) Instead of trying it out myself, I thought it would be fun to write a simple sudoku solver in awk on my trips. I wrote about the resulting script and my thoughts on awk in Yet Another Sudoku Puzzle Solver Using AWK a few years later.

I wrote:

“I believe that awk deserves a place in everyone’s toolkit. Its simplicity relative to other languages is perhaps seen as a weakness, but I see it as one of its strengths. The language can be learned in an afternoon and used without resorting to reference books for solving many day-to-day problems. I use it on a regular basis straight from the command line, right through to implementing things such as compilers for DSLs (Domain Specific Languages).”

In another article Turbocharge Awk Scripts – Translate into C, I wrote about how easy it was to translate the prototype awk script into C for more speed.

I think it’s important for systems people to learn different languages, so they have the ability to think about problems in different ways. Dijkstra understood that learning a language like “BASIC” could hamper the development of programmers. I believe the same thing about programmers who only know any one language. Stretching yourself to become multilingual gives you the ability to pull solutions together much more easily. The “awk” language is one of those underutilized jewels that should be in everyone’s toolkit, IMHO..

PS. I revisited this with my introduction to the Go language in From the Get Go!

One thought on “awk, the Often Ignored Little Language”

Comments are closed.