Linux and Unix awk command

Quick links

About awk
Syntax
Examples
Related commands
Linux and Unix main page

About awk

Short for Aho, Weinberger, and Kernighan, awk is a script processing language also known as oawk, gawk, mawk and nawk allows for pattern scanning and processing.

Syntax

awk [program | -f program file] [flags / variables] [files]

-f program fileRun an awk script from the specified file instead of from the command line.
variableInitializes the awk variable with the specified. Syntax is variable=value

The awk program can consist of one or more awk commands separated by a \n or semicolons.

Examples

awk myscript.sh

In the above example this command would execute the awk script "myscript.sh".

Related commands

bc
oawk
gawk
mawk
nawk