---

Using Variables With awk

[ Thanks to Andrew
Weber
for this link. ]

“Variables awk supports user defined variables as well
as variables that are predefined. These variables do not need to be
declared like they do in bash scripts. There are three types of
variables:

1. System Variables
2. Scalers
3. Arrays

System or Built-in Variables
System variables are upper case and case sensitive.

NR: number of input lines
The NR variable stores each record, when it is read it is
incremented by 1 as you see in the example.”

Complete
Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis