Transcript Slides
Kevin Taylor
History of AWK
Initially developed in 1977
Created in AT&T Bell Labs
Named after its developers
Standard on UNIX/Linux systems
Three main branches
What is it?
Procedural, data-driven scripting language
Syntax similar to bash and Perl
Quick video!
Versions of AWK
AWK ( 1977)
New awk, or nawk (1985)
GNU awk, or gawk (1986)
Awk++
What can AWK do for you
Strong text manipulator
Can easily find files/records
Can create automated records
Good at generating HTML
What it can't do
Not good at manipulating binary data
Not well suited for parsing HTML
Not a web programming language
AWK use today
AWK is available on almost all UNIX/Linux
systems
AWK itself is seldom used
GAWK is the most popular version
Normally not a go-to language
How to use it
UNIX/Linux/Mac OS X – already installed
Windows – install Cygwin (its free!)
Some websites are able to run AWK scripts
Many online tutorials
What AWK did
AWK was a major influence to Larry Wall (Perl)
AWK:
#!/usr/bin/awk -f
BEGIN { print “Hello world!” }
Perl:
#!/usr/bin/perl
print “Hello world!\n”;
Built-in variables
AWK has many built-in variables
All that were in AWK transferred to nawk/gawk
One of the most common is “FS” – Field Separator
Use to parse files
“-F” in command line works the same
FS Question
One Two:Three:4 Five
#!/bin/awk -f
{
print $2
FS=":"
print $2
}
Questions?