Jump to content

AWK: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
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.
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==
;Comparison 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==
==OS/2 Implementations==
;Compiler
;Compiler
* [[Preditor/2]] - Has a built in extended AWK compiler - Commercial - Discontinued.
* [[Preditor/2]] - Has a built in extended AWK compiler
* [[TAWK]] Compiler for OS/2 from ''Thompson Automation Software''
* [[TAWK]] Compiler for OS/2 from ''Thompson Automation Software''


;Interpreter
;Interpreter
* [[GNU awk]] - Open source - Current
* [[GNU awk]] - Open source
* QTAwk 1.22 (1997-01-07) - Shareware
* QTAwk 1.22 (1997-01-07) - Shareware
* mawk - Michael Brennan - Open Source (GPL) - Discontinued
* mawk - Michael Brennan - Open Source (GPL)
* SAWK - Sandeep Dutta


;Translators
;Translators
Line 15: Line 62:


;Editor support
;Editor support
* [[Elvis]] - awk syntax support included by default - Open source - Current
* [[Elvis]] - awk syntax support included by default
* [[Lugaru Epsilon]] - AWK syntax highlighting, code folding and syntax-aware autoindent available as a separate download. - Commercial.
* [[Lugaru Epsilon]] - AWK syntax highlighting, code folding and syntax-aware autoindent available as a separate download.
* [[NEdit]] - XFree86 - Autoindent, autocomplete and syntax highlighting.
* [[NEdit]] - XFree86 - Autoindent, autocomplete and syntax highlighting.
* [[Preditor/2]] - AWK template, syntax highlighting and debugging features - Commercial - Discontinued.
* [[Preditor/2]] - AWK template, syntax highlighting and debugging features.


;Programmer's utilities
;Programmer's utilities
Line 25: Line 72:
==DOS Implementations==
==DOS Implementations==
* Bawk - Bob Brodt
* Bawk - Bob Brodt
* [http://esca.atomki.hu/paradise/dos/awk-en.html Gawk]
* Gawk
* QTAwk - Pearl Boldt
* QTAwk - Pearl Boldt


;Editor support
;Editor support
* [[Elvis]] - awk syntax support included by default - Open source - Current
* [[Elvis]] - awk syntax support included by default
* [[Lugaru Epsilon]] - AWK syntax highlighting, code folding and syntax-aware autoindent available as a seperate download. - Commercial.
* [[Lugaru Epsilon]] - AWK syntax highlighting, code folding and syntax-aware auto-indent available as a separate download.


==Java Implementations==
==Java Implementations==
Line 36: Line 83:


;Editor support
;Editor support
* [[jEdit]] - Java based editor - AWK syntax highlighting built in - Current.
* [[jEdit]] - Java based editor - AWK syntax highlighting built in


==Publications==
==Publications==
Line 48: Line 95:
* [http://www.computerworld.com.au/article/216844/a-z_programming_languages_awk/ The A-Z of Programming Languages: AWK] - An interview with Alfred V. Aho - From [[Computerworld]]
* [http://www.computerworld.com.au/article/216844/a-z_programming_languages_awk/ The A-Z of Programming Languages: AWK] - An interview with Alfred V. Aho - From [[Computerworld]]


[[Category:Programming Languages]][[Category:AWK]]
[[Category:Scripting Language]][[Category:AWK]]

Latest revision as of 22:47, 10 April 2023

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

Comparison 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
  • TAWK Compiler for OS/2 from Thompson Automation Software
Interpreter
  • GNU awk - Open source
  • QTAwk 1.22 (1997-01-07) - Shareware
  • mawk - Michael Brennan - Open Source (GPL)
  • SAWK - Sandeep Dutta
Translators
  • a2p - AWK to PERL translator - Open source (included with Perl 5)
Editor support
  • Elvis - awk syntax support included by default
  • Lugaru Epsilon - AWK syntax highlighting, code folding and syntax-aware autoindent available as a separate download.
  • NEdit - XFree86 - Autoindent, autocomplete and syntax highlighting.
  • Preditor/2 - AWK template, syntax highlighting and debugging features.
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
  • Lugaru Epsilon - AWK syntax highlighting, code folding and syntax-aware auto-indent available as a separate download.

Java Implementations

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

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