Is there still any reason to learn AWK?
I think it depends on the environment you find yourself in. If you are a *nix person, then knowing awk
is a Good Thing. The only other scripting environment that can be found on virtually every *nix is sh
. So while grep
, sed,
etc can surely replace awk
on a modern mainstream linux
distro, when you move to more exotic systems, knowing a little awk
is going to be Real Handy.
awk
can also be used for more than just text processing. For example one of my supervisors writes astronomy code in awk
- that is how utterly old school and awesome he is. Back in his days, it was the best tool for the job... and now even though his students like me use python and what not, he sticks to what he knows and works well.
In closing, there is a lot of old code kicking around the world, knowing a little awk
isn't going to hurt. It will also make you better *nix person :-)
If you quickly learn the basics of awk, you can indeed do amazing things on the command line.
But the real reason to learn awk is to have an excuse to read the superb book The AWK Programming Language by Aho, Kernighan, and Weinberger.
The AWK Programming Language at archive.org
You would think, from the name, that it simply teaches you awk. Actually, that is just the beginning. Launching into the vast array of problems that can be tackled once one is using a concise scripting language that makes string manipulation easy — and awk was one of the first — it proceeds to teach the reader how to implement a database, a parser, an interpreter, and (if memory serves me) a compiler for a small project-specific computer language! If only they had also programmed an example operating system using awk, the book would have been a fairly complete survey introduction to computer science!
Famously clear and concise, like the original C Language book, it also is a wonderful example of friendly technical writing done right. Even the index is a piece of craftsmanship.
Awk? If you know it, you'll use it at the command-line occasionally, but for anything larger you'll feel trapped, unable to access the wider features of your system and the Internet that something like Python provides access to. But the book? You'll always be glad you read it!