Awk

AWK Vs NAWK Vs GAWK

by Ramesh Natarajan on June 29, 2011

Awk is a powerful language to manipulate and process text files. It is especially helpful when the lines in a text files are in a record format. i.e A record containing multiple fields separated by a delimiter. Even when the input file is not in a record format, you can still use awk to do some basic file and data processing. You can also write programming logic using awk even when there are no input files that needs to be processed.
(more…)

9 Powerful Awk Built-in Functions for Numeric

by Sasikala on March 17, 2010

Similar to awk built-in variables, awk also has lot of built-in functions for numeric, string, input, and ouput operations. Awk has the following three types of high level built-in function categories.

  1. Built-in functions for numeric operations
  2. Built-in functions for String operations
  3. Built-in functions for Input Output operations

(more…)

AWK Arrays Explained with 5 Practical Examples

by Sasikala on March 10, 2010

Awk programming language supports arrays. As part of our on-going awk examples series, we have seen awk user defined variables and awk built-in variables. Arrays are an extension of variables. Arrays are variable that hold more than one value. Similar to variables, arrays also has names. In some programming languages, arrays has to be declared, so that memory will be allocated for the arrays. Also, array indexes are typically integer, like array[1],array[2] etc.,
(more…)

Linux Awk For, While Loop ExamplesThis article is part of the on-going Awk Tutorial Examples series. In our earlier awk articles, we discussed about awk print, awk user-defined variables, awk built-in variables, awk operators, and awk conditional statements.

In this article, let us review about awk loop statements – while, do while, for loops, break, continue, and exit statements along with 7 practical examples.
(more…)

Linux Awk Tutorials - Conditional If Else Statement ExamplesThis article is part of the on-going Awk Tutorial Examples series. In our earlier awk articles, we discussed about awk print, awk user-defined variables, awk built-in variables, and awk operators.

In this awk tutorial, let us review awk conditional if statements with practical examples.
(more…)

Turbocharge Awk Scripts – Translate into C (Sudoku Revisted)

by Bill Duncan, VE3IED on February 10, 2010

Photo Courtesy: Kol Tregaskes

In the first article of this series we saw how awk could be put to work (or play) for more than just processing text. The simple script demonstrated the use of associative arrays, recursion and how we could use more arrays (more than required to represent the data) to speed up the processing. There were some teaser ideas left at the end if you were looking for something faster.
(more…)

Linux Awk Tutorials - Awk Reg-Ex Operator ExamplesThis article is part of the on-going Awk Tutorial Examples series. In our earlier awk articles, we discussed about awk print, awk user-defined variables, and awk built-in variables.

Like any other programming language Awk also has lot of operators for number and string operations. In this article let us discuss about all the key awk operators.
(more…)

Linux Awk Tutorial - Awk Built-in Variables ExamplesThis article is part of the on-going Awk Tutorial Examples series. Awk has several powerful built-in variables. There are two types of built-in variables in Awk.

  1. Variable which defines values which can be changed such as field separator and record separator.
  2. Variable which can be used for processing and reports such as Number of records, number of fields.

(more…)