AWK Resources by Predrag
What is AWK?
AWK is an expressive scripting programming language that can be applied to a wide variety of computing and data-manipulation tasks created at Bell Labs in the 1970s. Its name is derived from the family names of its authors: Alfred Aho, Peter Weinberger, and Brian Kernighan. It is an example of a programming language that extensively uses the string datatype, associative arrays (that is, arrays indexed by key strings), and regular expressions. AWK is one of the early tools to appear in Version 7 of Unix and gained popularity as a way to add computational features to a Unix pipeline. A version of the AWK language is a standard feature of nearly every modern Unix-like operating system available today. Even though AWK can be used on computers running the Windows family of operating systems, either as a stand-alone program (Gawk for Win) or via Cygwin, some familiarity with the Unix operating system is necessary. Before we continue further, the author of this web page would like to state for the record that he is an avid OpenBSD user, so he neither uses nor is familiar with a GNU version (Gawk) of the AWK programming language. This is also not a tutorial on the AWK programming language. Those who would like to learn AWK should look at the resources.
Downloads
I have put together some of the more useful AWK scripts that I have made over the years in the hopes that you may find them useful. The easiest way to run these scripts is to put them in a folder and then adjust permissions and the environment variable ($PATH).
- attendance.awk: This is a script for taking attendance. It takes a class roster (csv file) with student names and previous attendance and puts it into a new file with an additional column containing a time stamp and attendance record collected in an interactive fashion.
- attend_report.awk: is a script used to extract the last day of attendance as well as the number of class periods attended from the attendance records.
- drop_scores.awk: This script is used to drop a number of quiz/hw scores from a grade book and add the remaining scores.
- final_grades.awk: The name of the script says it all. Shame on all of you who ever wrote in my teaching evaluations that I play favorites. I have not even given you final grades; my computer did.
- handy one-liners : is a collection of useful one-line AWK scripts compiled by Eric Pement.
Slides
- Grade Book Made Easy with AWK slides are from a lecture I gave to my fellow colleagues on using the AWK programming language for grade book processing. This lecture is also known among Unix lovers under its unofficial name, "How to irritate the bones out of Excel users."
AWK Resources
AWK Tutorials
- AWK tutorial by Bruce Barnett
- An Awk Primer by Greg Goebel
Books about AWK
The AWK Programming Language by Alfred V. Aho, Brian W. Kernighan, and Peter J. Weinberger
sed & awk by Dale Dougherty and Arnold Robbins (the first edition is better than the second)
Effective awk Programming by Arnold Robbins