Using awk – Part 1
In this chapter, I’ll show you a bit about awk
. It’s a programming environment with a long and storied history that dates back to the 1970s, when it was invented by Alfred Aho, Peter Weinberger, and Brian Kernighan for use with the early Unix operating systems.
There are several ways in which you can use awk
. It is a full-blown programming language, so you can use it to write very complex, stand-alone programs. You can also create simple awk
commands that you can either run from the command-line or from within normal shell scripts. There’s a lot to awk
, and entire books have been written about it. The goal for this chapter is to show you how to use awk
in normal shell scripts.
Topics in this chapter include:
- Introducing
awk
- Understanding patterns and actions
- Obtaining input from text files
- Obtaining input from commands
If you’re ready to squawk with awk
, let’s get started.