Programming with AWK
Programming with AWK
This example will first initialize a variable i to zero and then print "Counting
sheep". The middle code block will be executed on each line which contains the
word sheep. It will first increment the value inside of the i variable by one and
print it out. After everything is done, it will write out "Finished".
You can also write the programs inside of a file and invoke the scripts with the f
option.