May 2017
Beginner
552 pages
28h 47m
English
The structure of an awk script is:
awk ' BEGIN{ print "start" } pattern { commands } END{ print "end"}' file
The awk command can also read from stdin.
An awk script includes up to three parts–:BEGIN, END, and a common statement block with the pattern match option. These are optional and any of them can be absent in the script.
Awk will process the file line by line. The commands following BEGIN will be evaluated before <code>awk</code> starts processing the file. Awk will process each line that matches PATTERN with the commands that follow PATTERN. Finally, after processing the entire file, <CODE>awk</CODE> will process the commands that follow END.