Finding elements in a file and presenting them in a specific format

awk is a powerful command that can perform many different operations on files. The general purpose of awk is to read the contents of one or more files, obtain selected pieces of information from the files, and present the information in a specified format.

One simple way to use awk is with a command line with the form:
awk '/regexp/ {action}' file
This asks awk to obtain information from the specified file. awk obtains the information by performing the specified action on every line in the file that contains a string matching the given regular expression, regexp. (For further information, see Regular expressions (regexp) in z/OS UNIX System Services Command Reference.) For example:
awk '/abc/ {print}' file
displays every record in the file that contains the string abc.

For more discussion on using awk, see Using awk.