Category:AWK
This programming language may be used to instruct a computer to perform a task.
Execution method: | Interpreted |
---|---|
See Also: |
|
AWK is a small but powerful programming language that can process and convert text files. AWK is part of every Unix-derived system.
Each AWK program consists of pattern-action statements.
The program reads each input line, checks lines against patterns, and runs matching actions.
For programs that never read input lines, the entire program can be one BEGIN { ... }
block.
- List users who have /bin/ksh as a shell.<lang awk>$ awk -F: '$7 == "/bin/ksh" { print $1 }' /etc/passwd</lang>
AWK has only three types of variables: they are strings, floating-point numbers, and associative arrays (where every array index is a string). Conversion between strings and numbers is automatic. AWK also has regular expressions, which appear in many AWK programs. There are a few built-in functions, like cos() and sprintf().
- Find average line length.<lang awk>$ awk '{ cnt += length($0) } END { print cnt / NR }' /etc/rc</lang>
The name "AWK" comes from the initials of Alfred Aho, Peter Weinberger and Brian Kernighan: they invented AWK during the 1970s. A few decades later, Kernighan continues to maintain the reference implementation of AWK.
Links
- awk(1) manual page, short and brief
- gawk GNU awk manual
- AWK in Wikipedia
- AWK Community Portal
Online-Execution
- ideone.com - gawk, mawk (both are kept up to date)
Todo
Subcategories
This category has the following 4 subcategories, out of 4 total.
@
- AWK Implementations (8 P)
- AWK User (69 P)
- Awk User (2 P)
Pages in category "AWK"
The following 109 pages are in this category, out of 709 total.
(previous page) (next page)S
- String concatenation
- String interpolation (included)
- String length
- String matching
- String prepend
- Strip a set of characters from a string
- Strip block comments
- Strip comments from a string
- Strip control codes and extended characters from a string
- Strip whitespace from a string/Top and tail
- Strong and weak primes
- Subleq
- Substring
- Substring primes
- Substring/Top and tail
- Successive prime differences
- Sudan function
- Sudoku
- Sum and product of an array
- Sum and product puzzle
- Sum digits of an integer
- Sum multiples of 3 and 5
- Sum of a series
- Sum of divisors
- Sum of elements below main diagonal of matrix
- Sum of first n cubes
- Sum of primes in odd positions is prime
- Sum of square and cube digits of an integer are primes
- Sum of squares
- Sum of the digits of n is substring of n
- Sum of two adjacent numbers are primes
- Sum to 100
- Summarize primes
- Summation of primes
- Superpermutation minimisation
- Sylvester's sequence
- Symmetric difference
- Syntax highlighting using Mediawiki formatting
- System time
T
- Table creation
- Table creation/Postal addresses
- Take notes on the command line
- Tau function
- Tau number
- Taxicab numbers
- Teacup rim text
- Temperature conversion
- Terminal control/Clear the screen
- Terminal control/Display an extended character
- Terminal control/Inverse video
- Terminal control/Ringing the terminal bell
- Terminal control/Unicode output
- Test integerness
- Text between
- Text processing/1
- Text processing/2
- Text processing/Max licenses in use
- Textonyms
- The Name Game
- The Twelve Days of Christmas
- Thue-Morse
- Tic-tac-toe
- Tokenize a string
- Top rank per group
- Totient function
- Towers of Hanoi
- Trabb Pardo–Knuth algorithm
- Tree traversal
- Trigonometric functions
- Triplet of three numbers
- Truncatable primes
- Truncate a file
- Twin primes
- Two identical strings
- Two sum
- Type detection