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 200 pages are in this category, out of 709 total.
(previous page) (next page)M
N
- N'th
- N-queens problem
- Naming conventions
- Narcissistic decimal number
- Nautical bell
- Neighbour primes
- Next special primes
- Nice primes
- Nim game
- Non-decimal radices/Convert
- Non-decimal radices/Output
- Nth root
- Null object
- Number names
- Number reversal game
- Numbers divisible by their individual digits, but not by the product of their digits.
- Numbers in base 10 that are palindromic in bases 2, 4, and 16
- Numbers in base-16 representation that cannot be written with decimal digits
- Numbers whose binary and ternary digit sums are prime
- Numbers whose count of divisors is prime
- Numbers with equal rises and falls
- Numbers with prime digits whose sum is 13
- Numbers with same digit set in base 10 and base 16
- Numeric separator syntax
- Numerical integration/Adaptive Simpson's method
O
P
- Palindrome dates
- Palindrome detection
- Palindromic primes
- Palindromic primes in base 16
- Pancake numbers
- Pangram checker
- Parse command-line arguments
- Parsing/RPN to infix conversion
- Pascal's triangle
- Password generator
- Pathological floating point problems
- Perfect numbers
- Perfect totient numbers
- Permutation test
- Permutations
- Permutations with repetitions
- Pernicious numbers
- Phrase reversals
- Pick random element
- Pig the dice game
- Piprimes
- Plasma effect
- Polynomial regression
- Population count
- Positive decimal integers with the digit 1 occurring exactly twice
- Power set
- Price fraction
- Primality by trial division
- Primality by Wilson's theorem
- Prime decomposition
- Prime numbers p for which the sum of primes less than or equal to p is prime
- Prime numbers which contain 123
- Prime triplets
- Prime words
- Primes which contain only one odd digit
- Primes whose first and last number is 3
- Primes whose sum of digits is 25
- Primes with digits in nondecreasing order
- Probabilistic choice
- Product of divisors
- Program name
- Program termination
- Proper divisors
- Pseudo-random numbers/Middle-square method
- Pythagorean quadruples
- Pythagorean triples
R
- Ramsey's theorem
- Random number generator (included)
- Random numbers
- Range expansion
- Range extraction
- Ranking methods
- Read a configuration file
- Read a file line by line
- Read a specific line from a file
- Read entire file
- Real constants and functions
- Recaman's sequence
- Regular expressions
- Remove duplicate elements
- Remove lines from a file
- Remove vowels from a string
- Rename a file
- Repeat
- Repeat a string
- Reverse a string
- Reverse the order of lines in a text file while preserving the contents of each line
- Reverse words in a string
- Roman numerals/Decode
- Roman numerals/Encode
- Roots of unity
- Rosetta Code/Rank languages by popularity
- Rot-13
- Round-robin tournament schedule
- Run-length encoding
- Runge-Kutta method
S
- Safe and Sophie Germain primes
- Safe mode
- Safe primes and unsafe primes
- Sailors, coconuts and a monkey problem
- Scope/Function names and labels
- Search a list
- Search in paragraph's text
- SEDOLs
- Selective file copy
- Self numbers
- Self-describing numbers
- Semiprime
- Semordnilap
- Sequence of non-squares
- Sequence of primes by trial division
- Sequence: smallest number greater than previous term with exactly n divisors
- Sequence: smallest number with exactly n divisors
- Sexy primes
- SHA-256
- Shell one-liner
- Shift list elements to left by 3
- Short-circuit evaluation
- Show ASCII table
- Show the (decimal) value of a number of 1s appended with a 3, then squared
- Show the epoch
- Sierpinski carpet
- Sierpinski triangle
- Sieve of Eratosthenes
- Singly-linked list/Element definition
- Sleep
- Smallest power of 6 whose decimal expansion contains n
- Smallest square that begins with n
- Smarandache prime-digital sequence
- Smith numbers
- Snake and ladder
- Sockets
- Solve equations with substitution method
- Sort a list of object identifiers
- Sort an array of composite structures
- Sort an integer array
- Sort numbers lexicographically
- Sort primes from list to a list
- Sort stability
- Sort the letters of string in alphabetical order
- Sort using a custom comparator
- Sorting algorithms/Bogosort
- Sorting algorithms/Bubble sort
- Sorting algorithms/Cocktail sort
- Sorting algorithms/Comb sort
- Sorting algorithms/Gnome sort
- Sorting algorithms/Insertion sort
- Sorting algorithms/Quicksort
- Sorting algorithms/Selection sort
- Sorting algorithms/Shell sort
- Soundex
- Special characters
- Special neighbor primes
- Special pythagorean triplet
- Special variables
- Spinning rod animation/Text
- Spiral matrix
- Split a character string based on change of character
- Square but not cube
- Square-free integers
- Stack
- Stair-climbing puzzle
- Start from a main routine
- Steady squares
- Stem-and-leaf plot
- Strange numbers
- Strange plus numbers
- Strange unique prime triplets
- Stream merge
- String append
- String case
- String comparison