Knowledge for the World

What is awk?

According to the manual, awk is a pattern-directed scanning and processing language.

This quick definition provides a few insights.

First, awk is a scanning and processing language. The primary purpose of awk is to process some input and transform it. Since many unix utilities format information in rows and columns, awk is designed to process these rows and columns.

Second, awk is pattern-directed which means awk uses patterns to determine which data to perform some action on.

The basic form of an awk statement is:

    pattern {action}

If the action is excluded, it will print every line. And if the pattern is excluded, it will match every line. The user must include at least the pattern or the action. Obviously, awk wouldn't be very useful with neither included.

Learn more by reading some awk basic examples.