awktutorial/00-intro.awk

35 lines
1.3 KiB
Awk
Executable File

#!/usr/bin/awk -f
# https://www.grymoire.com/Unix/Awk.html
# this is a hands-on awk tutorial. it was written loosely following
# the sequence in bruce barnett's awk tutorial, linked above. and it
# is designed that you can read and execute each script. these
# scripts are *not* the same scripts as in barnett's tutorial,
# although some may be similar.
# barnett's tutorial covers more material and in more detail, so you
# are encouraged to browse it if you want to learn more. this shell-
# based tutorial is designed as a quick start and to give you an idea
# of the essential features of awk.
# there are several versions of awk:
# nawk and gawk are probably the most common.
# this tutorial covers gawk alone, the gnu version of awk.
# read about other version of awk here, if interested:
# https://www.gnu.org/software/gawk/manual/html_node/Other-Versions.html
# ignore the code below for now. you'll learn what it means soon
# enough. but you can execute this script by running ./01.awk from
# the command line.
BEGIN {
print "This is a hands-on awk tutorial."
print "Read the file to start learning. Don't just run the script."
}
# each file in this tutorial is an executable awk script, although most
# are toyishly simple, just designed to demonstrate a specific feature
# of the language