Using awk
awk is a program, which has its own programming language for performing data processing and to generate reports.
The GNU version of awk is gawk.
awk processes data, which can be received from a standard input, input file, or as the output of any other command or process.
awk processes data similar to sed, such as lines by line. It processes every line for the specified pattern and performs specified actions. If pattern is specified, then all the lines containing specified patterns will be displayed. If pattern
is not specified, then the specified actions will be performed on all the lines.
The meaning of awk
The name of the program awk is made from the initials of three authors of the language, namely Alfred Aho, Peter Weinberger and Brian Kernighan. It is not very clear why they selected the name awk instead of kaw or wak!
Using awk
The following are different ways to use awk:
- Syntax while using only
pattern
:$ awk 'pattern' filename
In this case, all the lines containing...