The awk command processes data streams. It supports associative arrays, recursive functions, conditional statements, and more.
Using awk for advanced text processing
Getting ready
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...