Awk

From Psygen Wiki
Revision as of 16:42, 30 December 2016 by Admin (talk | contribs)
Jump to navigation Jump to search

awk parses reports, among other text manipulation

Usage:

awk pattern {action}

Structure

BEGIN The begin block runs at the start of the awk program, and runs only once.


Operators

\ The \ tells awk that a special character follows the slash, and to interpret it differently than regular text

Example: \t means a tab character

$ field (column) reference

Example: $2 tells awk to do something to the 2nd field (column) of the input. (Note that awk does not interpret variables inside strings.)

References

  1. awk man page
  2. awk tutorial