AWK

From EDM2
Revision as of 18:28, 15 August 2018 by Ak120 (Talk | contribs)

Jump to: navigation, search

AWK is a pattern matching programming language primarily used in UNIX like systems for software pre-processing and other text handling tasks. It is named after initials of original writers Alfred Aho, Peter Weinberger, and Brian Kernighan and should therefore be spelled all caps.

History

  • 1977: old awk (awk)
  • new awk (nawk)
  • POSIX awk

Constructs

Comparsion Expressions
Relational Operators:
< <= == != >= > ~ !~
Conditional Expressions
Computation
+ - * / % ^
Compound Patterns
&& || !
Range Patterns
Variables
Conditional Statements
if
if/else
Loops
while
for
Program Control
next
exit
Arrays

Built-In Functions

String

  • sub, gsub
  • index
  • length
  • substr
  • match
  • split

Arithmetic

  • atan2
  • cos
  • exp
  • int
  • log
  • rand
  • sin
  • sqrt
  • srand

OS/2 Implementations

Compiler
  • Preditor/2 - Has a built in extended AWK compiler - Commercial - Discontinued.
  • TAWK Compiler for OS/2 from Thompson Automation Software
Interpreter
  • GNU awk - Open source - Current
  • QTAwk 1.22 (1997-01-07) - Shareware
  • mawk - Michael Brennan - Open Source (GPL) - Discontinued
Translators
  • a2p - AWK to PERL translator - Open source (included with Perl 5)
Editor support
  • Elvis - awk syntax support included by default - Open source - Current
  • Lugaru Epsilon - AWK syntax highlighting, code folding and syntax-aware autoindent available as a separate download. - Commercial.
  • NEdit - XFree86 - Autoindent, autocomplete and syntax highlighting.
  • Preditor/2 - AWK template, syntax highlighting and debugging features - Commercial - Discontinued.
Programmer's utilities
  • Exuberant ctags - Creates index files out of AWK source files - Open source - Current.

DOS Implementations

  • Bawk - Bob Brodt
  • Gawk
  • QTAwk - Pearl Boldt
Editor support
  • Elvis - awk syntax support included by default - Open source - Current
  • Lugaru Epsilon - AWK syntax highlighting, code folding and syntax-aware auto-indent available as a separate download. - Commercial.

Java Implementations

  • Jawk - J2SE 5
Editor support
  • jEdit - Java based editor - AWK syntax highlighting built in - Current.

Publications

  • Leon S. Levy: A Walk Through AWK, SIGPLAN Notices Vol. 18 #12 Dec 1983, pp.69-85
  • Alfred V. Aho, Brian W. Kernighan, and Peter J. Weinberger: The AWK Programming Language Addison-Wesley 1988, ISBN 0-201-07981-X
  • Dale Dougherty, Arnold Robbins: sed & awk O’Reilly 1997, ISBN 1-56592-225-5
  • Arnold Robbins: GAWK: Effective AWK Programming O’Reilly 2001, ISBN 0-596-00070-7

Links