Category:AWK: Difference between revisions
m (Changed over to language template.) |
m (update links) |
||
(20 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{language |
{{language |
||
|exec=interpreted |
|||
|tag=awk |
|||
}}{{CompileOnline}} |
|||
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. |
|||
'''AWK''' is a general purpose programming language that is designed for processing text-based data, either in files or data streams. AWK is an example of a programming language that extensively uses the string datatype, associative arrays (that is, arrays indexed by key strings), and regular expressions. The power, terseness, and limitations of AWK programs and sed scripts inspired Larry Wall to write Perl. Because of their dense notation, all these languages are often used for writing one-liner programs. |
|||
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 <code>BEGIN { ... }</code> block. |
|||
* ''List users who have /bin/ksh as a shell.''<lang awk>$ awk -F: '$7 == "/bin/ksh" { print $1 }' /etc/passwd</lang> |
|||
==Citations== |
|||
* [http://en.wikipedia.org/wiki/AWK_%28programming_language%29 Wikipedia:AWK] |
|||
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 [[nawk|reference implementation]] of AWK. |
|||
==Links== |
|||
*[http://leaf.dragonflybsd.org/cgi/web-man?command=awk§ion=1 awk(1) manual page], short and brief |
|||
*[https://www.gnu.org/software/gawk/ gawk] GNU awk [https://www.gnu.org/software/gawk/manual/ manual] |
|||
*[[wp:AWK (programming language)|AWK in Wikipedia]] |
|||
*[http://awk.info AWK Community Portal] |
|||
==Online-Execution== |
|||
* [https://ideone.com ideone.com] - gawk, mawk (both are kept up to date) |
|||
==Todo== |
|||
[[Tasks_not_implemented_in_AWK]] |
Latest revision as of 18:59, 8 August 2023
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)2
A
- A+B
- Abbreviations, automatic
- Abbreviations, easy
- ABC problem
- ABC words
- Abundant odd numbers
- Abundant, deficient and perfect number classifications
- Ackermann function
- Additive primes
- Air mass
- Align columns
- Aliquot sequence classifications
- Almost prime
- Alternade words
- Amicable pairs
- Anadromes
- Anagrams
- Anagrams/Deranged anagrams
- Angle difference between two bearings
- Angles (geometric), normalization and conversion
- Anti-primes
- Append a record to the end of a text file
- Append numbers at same position in strings
- Apply a callback to an array
- Approximate equality
- Archimedean spiral
- Arithmetic-geometric mean
- Arithmetic/Complex
- Arithmetic/Integer
- Array concatenation
- Array length
- Arrays
- Ascending primes
- Assertions
- Associative array/Creation
- Associative array/Iteration
- Associative array/Merging
- Attractive numbers
- Audio alarm
- Averages/Arithmetic mean
- Averages/Mean angle
- Averages/Mean time of day
- Averages/Median
- Averages/Mode
- Averages/Pythagorean means
- Averages/Root mean square
- Averages/Simple moving average
B
C
- Caesar cipher
- Calculating the value of e
- Calendar
- Call a function
- Cantor set
- Carmichael 3 strong pseudoprimes
- Case-sensitivity of identifiers
- Casting out nines
- Catalan numbers
- Catalan numbers/Pascal's triangle
- Change e letters to i in words
- Changeable words
- Character codes
- Check that file exists
- Cheryl's birthday
- Chinese remainder theorem
- Chinese zodiac
- Chowla numbers
- Circles of given radius through two points
- Circular primes
- Cistercian numerals
- Closest-pair problem
- Code Golf: Code Golf
- Collect and sort square numbers in ascending order from three lists
- Collections
- Colour bars/Display
- Combinations
- Combinations with repetitions
- Comma quibbling
- Command-line arguments
- Comments
- Common list elements
- Common sorted list
- Compare a list of strings
- Compare length of two strings
- Compiler/code generator
- Compiler/lexical analyzer
- Compiler/Simple file inclusion pre processor
- Compiler/syntax analyzer
- Compiler/virtual machine interpreter
- Compound data type
- Concatenate two primes is also prime
- Conditional structures
- Conjugate a Latin verb
- Convert seconds to compound duration
- Conway's Game of Life
- Coprimes
- Copy a string
- Copy stdin to stdout
- Count how many vowels and consonants occur in a string
- Count in factors
- Count in octal
- Count occurrences of a substring
- Count the coins
- Cousin primes
- Create a file
- Create a two-dimensional array at runtime
- Create an executable for a program in an interpreted language
- Create an HTML table
- CSV data manipulation
- CSV to HTML translation
- Cubic special primes
- Cullen and Woodall numbers
- Cumulative standard deviation
- Currency
- CUSIP
- Cyclops numbers
D
- Damm algorithm
- Date format
- Date manipulation
- Day of the week
- Day of the week of Christmas and New Year
- Days between dates
- Deceptive numbers
- Decision tables
- Deepcopy
- Delete a file
- Department numbers
- Descending primes
- Determine if a string has all the same characters
- Determine if a string has all unique characters
- Determine if a string is collapsible
- Determine if a string is numeric
- Determine if a string is squeezable
- Determine sentence type
- Digit fifth powers
- Digital root
- Digital root/Multiplicative digital root
- Dijkstra's algorithm
- Dinesman's multiple-dwelling problem
- Disarium numbers
- Discordian date
- Dot product
- Draw a clock
- Draw a cuboid
- Draw a sphere
- Dutch national flag problem
- Dynamic variable names
E
- Eban numbers
- Emirp primes
- Empty directory
- Empty program
- Empty string
- Entropy
- Entropy/Narcissist
- Enumerations
- Environment variables
- Equilibrium index
- Erdős-primes
- Ethiopian multiplication
- Euclid-Mullin sequence
- Euler's sum of powers conjecture
- Evaluate binomial coefficients
- Even or odd
- Evolutionary algorithm
- Exactly three adjacent 3 in lists
- Execute a system command
- Execute Brain****
- Exponentiation operator
- Exponentiation order
- Exponentiation with infix operators in (or operating on) the base
- Extra primes
- Extract file extension
- Extreme floating point values