AWK

AWK
ParadigmScripting, procedural, data-driven[1]
Designed byAlfred Aho, Peter Weinberger, and Brian Kernighan
First appeared1977; 47 years ago (1977)
Stable release
IEEE Std 1003.1-2008 (POSIX) / 1985
Typing disciplinenone; can handle strings, integers and floating-point numbers; regular expressions
OSCross-platform
Major implementations
awk, GNU Awk, mawk, nawk, MKS AWK, Thompson AWK (compiler), Awka (compiler)
Dialects
old awk oawk 1977, new awk nawk 1985, GNU Awk gawk
Influenced by
C, sed, SNOBOL[2][3]
Influenced
Tcl, AMPL, Perl, Korn Shell (ksh93, dtksh, tksh), Lua
Preview warning: Page using Template:Infobox programming language with unknown parameter "screenshot_caption"

AWK (/ɔːk/[4]) is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter,[4] and it is a standard feature of most Unix-like operating systems.

The AWK language is a data-driven scripting language consisting of a set of actions to be taken against streams of textual data – either run directly on files or used as part of a pipeline – for purposes of extracting or transforming text, such as producing formatted reports. The language extensively uses the string datatype, associative arrays (that is, arrays indexed by key strings), and regular expressions. While AWK has a limited intended application domain and was especially designed to support one-liner programs, the language is Turing-complete, and even the early Bell Labs users of AWK often wrote well-structured large AWK programs.[5]

AWK was created at Bell Labs in the 1970s,[6] and its name is derived from the surnames of its authors: Alfred Aho (author of egrep), Peter Weinberger (who worked on tiny relational databases), and Brian Kernighan. The acronym is pronounced the same as the name of the bird species auk, which is illustrated on the cover of The AWK Programming Language.[7] When written in all lowercase letters, as awk, it refers to the Unix or Plan 9 program that runs scripts written in the AWK programming language.

  1. ^ Stutz, Michael (September 19, 2006). "Get started with GAWK: AWK language fundamentals" (PDF). developerWorks. IBM. Archived (PDF) from the original on 2015-04-27. Retrieved 2015-01-29. [AWK is] often called a data-driven language -- the program statements describe the input data to match and process rather than a sequence of program steps
  2. ^ Andreas J. Pilavakis (1989). UNIX Workshop. Macmillan International Higher Education. p. 196.
  3. ^ Arnold Robbins (2015). Effective Awk Programming: Universal Text Processing and Pattern Matching (4th ed.). O'Reilly Media. p. 560.
  4. ^ a b James W. Livingston (May 2, 1988). "The Great awk Program is No Birdbrain". Digital Review. p. 91.
  5. ^ Raymond, Eric S. "Applying Minilanguages". The Art of Unix Programming. Case Study: awk. Archived from the original on July 30, 2008. Retrieved May 11, 2010. The awk action language is Turing-complete, and can read and write files.
  6. ^ Aho, Alfred V.; Kernighan, Brian W.; Weinberger, Peter J. (September 1, 1978). Awk — A Pattern Scanning and Processing Language (Second Edition) (Technical report). Unix Seventh Edition Manual, Volume 2. Bell Telephone Laboratories, Inc. Retrieved February 1, 2020.
  7. ^ Cite error: The named reference AWK1 was invoked but never defined (see the help page).