Knowledge (XXG)

AWK

Source 📝

45: 54: 4641: 4192: 4214: 501: 1615:
The BEGIN block sets the field separator to any sequence of non-alphabetic characters. Separators can be regular expressions. After that, we get to a bare action, which performs the action on every input line. In this case, for every field on the line, we add one to the number of times that word,
487:
and current line variables. The power and terseness of early AWK programs – notably the powerful regular expression handling and conciseness due to implicit variables, which facilitate one-liners – together with the limitations of AWK at the time, were important inspirations for the
2137:
tells awk that the argument that follows is the file to read the AWK program from, which is the same flag that is used in sed. Since they are often used for one-liners, both these programs default to executing a program given as a command-line argument, rather than a separate file.
656:
in the examples above. AWK commands can include function calls, variable assignments, calculations, or any combination thereof. AWK contains built-in support for many functions; many more are provided by the various flavors of AWK. Also, some flavors support the inclusion of
1435:
is true for the 3rd, 7th, 11th, etc., lines of input. The range pattern is false until the first part matches, on line 1, and then remains true up to and including when the second part matches, on line 3. It then stays false until the first part matches again on line 5.
929:: Field Separator. Contains the "field separator" used to divide fields in the input record. The default, "white space", allows any sequence of space and tab characters. FS can be reassigned with another character or character sequence to change the field separator. 2346:
program) is another translator of AWK scripts into C code. When compiled, statically including the author's libawka.a, the resulting executables are considerably sped up and, according to the author's tests, compare very well with other versions of AWK,
1711:
in the awk command is not protected by single quotes so that the shell does expand the variable but it needs to be put in double quotes to properly handle patterns containing spaces. A pattern by itself in the usual way checks to see if the whole line
560:
is a series of commands. The input is split into records, where by default records are separated by newline characters so that the input is split into lines. The program tests each record against each of the conditions in turn, and executes the
2197:. It has been dubbed the "One True AWK" because of the use of the term in association with the book that originally described the language and the fact that Kernighan was one of the original authors of AWK. FreeBSD refers to this version as 970:, simply place two variables (or string constants) next to each other. It is optional to use a space in between if string constants are involved, but two variable names placed adjacent to each other require a space in between. Double quotes 565:
for each expression that is true. Either the condition or the action may be omitted. The condition defaults to matching every record. The default action is to print the record. This is the same pattern-action structure as sed.
1865:
Finally, this is written in pure awk, without help from a shell or without the need to know too much about the implementation of the awk script (as the variable assignment on command line one does), but is a bit lengthy:
1439:
Thus, the program prints lines 1,2,3, skips line 4, and then 5,6,7, and so on. For each line, it prints the line number (on a 6 character-wide field) and then the line contents. For example, when executed on this input:
1074:
Functions can have variables that are in the local scope. The names of these are added to the end of the argument list, though values for these should be omitted when calling the function. It is convention to add some
2279:
includes a persistent memory feature that can remember script-defined variables and functions from one invocation of a script to the next and pass data between unrelated scripts, as described in the Persistent-Memory
917:: Number of Fields. Contains the number of fields in the current input record. The last field in the input record can be designated by $ NF, the 2nd-to-last field by $ (NF-1), the 3rd-to-last field by $ (NF-2), etc. 1335:, it will by default be an empty string. Adding zero to a variable is an AWK idiom for coercing it from a string to a numeric value. (Concatenating an empty string is to coerce from a number to a string, e.g. 677:
command is used to output text. The output text is always terminated with a predefined string called the output record separator (ORS) whose default value is a newline. The simplest form of this command is:
3158: 1308:
is the value of the last field in the line regardless of how many fields this line has, or whether it has more or fewer fields than surrounding lines. $ is actually a unary operator with the highest
2079:
to 1 so that there are no arguments, awk will simply quit because it feels there are no more input files. Therefore, you need to explicitly say to read from standard input with the special filename
891:
Awk's built-in variables include the field variables: $ 1, $ 2, $ 3, and so on ($ 0 represents the entire record). They hold the text or values in the individual text-fields in a record.
1339:. Note, there's no operator to concatenate strings, they're just placed adjacently.) With the coercion the program prints "0" on an empty input, without it, an empty line is printed. 707:
Displays the first and third fields of the current record, separated by a predefined string called the output field separator (OFS) whose default value is a single space character
935:: Record Separator. Stores the current "record separator" character. Since, by default, an input line is the input record, the default record separator character is a "newline". 2953: 901:: Number of Records. Keeps a current count of the number of input records read so far from all data files. It starts at zero, but is never automatically reset to zero. 3071: 2391:, hosted on SourceForge. Extensions to the language are added to provide access to Java features within AWK scripts (i.e., Java threads, sockets, collections, etc.). 4686: 4696: 4676: 3099: 460:, released in 1988. GNU AWK may be the most widely deployed version because it is included with GNU-based Linux packages. GNU AWK has been maintained solely by 3154: 947:: Output Record Separator. Stores the "output record separator", which separates the output records when Awk prints them. The default is a "newline" character. 508:
AWK reads the input a line at a time. A line is scanned for each pattern in the program, and for each pattern that matches, the associated action is executed.
4711: 2715: 403:
According to Brian Kernighan, one of the goals of AWK was to have a tool that would easily manipulate both numbers and strings. AWK was also inspired by
1230:
As there is no pattern for the first line of the program, every line of input matches by default, so the increment actions are executed for every line.
4252: 2267:
enables the user to make measured performance enhancements to a script. It also enables the user to extend functionality with shared libraries. Some
4681: 941:: Output Field Separator. Stores the "output field separator", which separates the fields when Awk prints them. The default is a "space" character. 4721: 3580: 2730:
often called a data-driven language -- the program statements describe the input data to match and process rather than a sequence of program steps
1419:
is the number of records, typically lines of input, AWK has so far read, i.e. the current line number, starting at 1 for the first line of input.
3213: 3477: 2153:
In 1985 its authors started expanding the language, most significantly by adding user-defined functions. The language is described in the book
472:(New AWK) source was first released in 1993 unpublicized, and publicly since the late 1990s; many BSD systems use it to avoid the GPL license. 2541: 2260: 3411: 479:(1974). Both were designed for text processing. They share the line-oriented, data-driven paradigm, and are particularly suited to writing 3463: 2263:
and TCP/IP networking. It was written before the original implementation became freely available. It includes its own debugger, and its
165: 3524: 3130: 3535: 3044: 2876: 2638: 2607: 2577: 2499: 2412: 4671: 3180: 2264: 2947: 4716: 4706: 4205: 4200: 2437:
includes an AWK implementation written by Dmitry Zakharov. This is a very small implementation suitable for embedded systems.
2793: 1804:
The next way uses command-line variable assignment, in which an argument to awk can be seen as an assignment to a variable:
1093: 492:
language (1987). In the 1990s, Perl became very popular, competing with AWK in the niche of Unix text-processing languages.
3390: 3061: 3010: 2030:
is necessary not only to extract the first argument, but also to prevent it from being interpreted as a filename after the
4245: 1331:
is printed. However, since there may have been no lines of input at all, in which case no value has ever been assigned to
339: 323:– for purposes of extracting or transforming text, such as producing formatted reports. The language extensively uses the 4701: 2155: 379: 2921: 2644: 3573: 2388: 2209:
that are explained above; see the FIXES file in the source archive for details. This version is used by, for example,
2098:
For example, a script that sends the content of a given file to standard output may be built by creating a file named
1616:
first converted to lowercase, appears. Finally, in the END block, we print the words with their frequencies. The line
123: 3095: 1079:
in the argument list before the local variables, to indicate where the parameters end and the local variables begin.
426:, the only scripting language available in a standard Unix environment. It is one of the mandatory utilities of the 4575: 3334: 2366: 2210: 658: 253: 3243: 2405:
with dynamically loadable libraries. The XMLgawk extension was integrated into the official GNU Awk release 4.1.0.
2259:
awk) is another free-software implementation and the only implementation that makes serious progress implementing
1720:
contains the current filename. awk has no explicit concatenation operator; two adjacent strings concatenate them.
4611: 4531: 4177: 4147: 3490: 1320:
is the whole line, which in this case is empty apart from possible white-space, and so has the numeric value 0.)
427: 324: 3272: 2700: 2065:
block. awk only checks to see if it should read from standard input before it runs the command. This means that
4691: 4645: 4238: 4162: 3303: 2670: 2416: 1727:
There are alternate ways of writing this. This shell script accesses the environment directly from within awk:
987: 974:
string constants. Statements need not end with semicolons. Finally, comments can be added to programs by using
282: 205: 1461:, the range will start at the beginning of the input. Similarly, if the second part is constantly false, e.g. 4230: 1775:, an array introduced in a newer version of the One True awk after the book was published. The subscript of 438: 309: 74: 1415:
and works similarly to the print command described above. The pattern to match, however, works as follows:
4666: 4264: 4218: 3923: 3592: 3566: 3558: 2311: 70: 3354: 2163:. To avoid confusion with the incompatible older version, this version was sometimes called "new awk" or 4261: 2974: 2675: 2168: 392: 3208: 3188: 1791:
containing the first argument, then drops that argument and has awk look for the pattern in each file.
715:) may bear resemblance to variables (the $ symbol indicates variables in the usual Unix shells and in 3370: 3203: 962:
Variable names can use any of the characters , with the exception of language keywords. The operators
407:'s programming language that was used to search for patterns in input data, and was implemented using 4562: 4093: 4041: 3484: 1076: 177: 129: 61: 31: 2182:, which converted AWK to C. Kernighan wrote a program to turn awk into C++; its state is not known. 1296:, which is the last word on the line as defined by AWK's field separator (by default, white-space). 604:
In addition to normal arithmetic and logical operators, AWK expressions include the tilde operator,
461: 2838: 2834: 2665: 2523: 2479: 1309: 431: 366: 90: 2411:
is an embedded AWK interpreter implementation included in the QSE library that provides embedding
2336:
is a fork of mawk, allowing applications to embed multiple parallel instances of awk interpreters.
453: 3766: 3756: 2907: 2268: 609: 449: 335: 316: 312: 66: 3489:: pattern scanning and processing language – Shell and Utilities Reference, 44: 3040: 2872: 2634: 2603: 2573: 2569: 2547: 2537: 2495: 2378: 1497: 994:, the function name, argument names and the function body. Here is an example of a function. 620:
without using the tilde operator matches against the current record; this syntax derives from
480: 442: 343: 331: 298: 1779:
is the name of an environment variable; its result is the variable's value. This is like the
4430: 3993: 3898: 3893: 1424: 1411:
The action statement prints each line numbered. The printf function emulates the standard C
1126:
Print all lines longer than 80 characters. The default action is to print the current line.
625: 457: 350:, and even the early Bell Labs users of AWK often wrote well-structured large AWK programs. 267: 152: 2843:(Technical report). Unix Seventh Edition Manual, Volume 2. Bell Telephone Laboratories, Inc 907:: File Number of Records. Keeps a current count of the number of input records read so far 4626: 4518: 4352: 4172: 4116: 4021: 3822: 3725: 3121: 2830: 2790: 2519: 2475: 2233:. Brian Kernighan and Arnold Robbins are the main contributors to a source repository for 2194: 613: 465: 419: 370: 347: 320: 286: 94: 81: 3545: 1634:
of the array. This is different from most languages, where such a loop goes through each
2453:
is an AWK implementation in Go with a few convenience extensions by Ben Hoyt, hosted on
966:
represent addition, subtraction, multiplication, and division, respectively. For string
4621: 4580: 4503: 4460: 4435: 4368: 4312: 4111: 4046: 4031: 3968: 3928: 3807: 3771: 3665: 3494: 2593: 2533: 2491: 2147: 2092: 2091:
On Unix-like operating systems self-contained AWK scripts can be constructed using the
1493: 687:
This displays the contents of the current record. In AWK, records are broken down into
415: 157: 53: 1801:
is its inverse. A regular expression is just a string and can be stored in variables.
4660: 4616: 4495: 4347: 4268: 4152: 4013: 3948: 3720: 3695: 3596: 3528: 3395: 3066: 2484: 2160: 967: 437:
In 1983, AWK was one of several UNIX tools available for Charles River Data Systems'
404: 3455: 3435: 3415: 2866: 2381:, previously sold by Thompson Automation Software (which has ceased its activities). 2286: 1159:
Count words in the input and print the number of lines, words, and characters (like
953:: Output Format. Stores the format for numeric output. The default format is "%.6g". 4590: 4455: 4342: 4126: 4026: 3943: 3938: 3842: 3751: 3715: 3670: 1651: 1642:
was an addition to the One True awk (see below) made after the book was published.
1457:
As a special case, when the first part of a range pattern is constantly true, e.g.
866:# Actions to perform in the event the record (line) matches the above regex_pattern 831:# Actions to perform in the event the record (line) matches the above regex_pattern 749:# Actions to perform in the event the record (line) matches the above regex_pattern 423: 1964:# the pattern was the only thing, so force read from standard input (used by book) 1654:
to make a shell script that does everything. It is the shortest of these methods:
1638:
in the array. The loop thus prints out each word followed by its frequency count.
147:
none; can handle strings, integers and floating-point numbers; regular expressions
2801: 585:
causing the action to be executed before or after all records have been read, or
4508: 4465: 4450: 4440: 4062: 4036: 3973: 3963: 3953: 3918: 3908: 3903: 3786: 3776: 3730: 2999: 2444: 852: 142: 2171:
in 1996 and is still maintained by Brian Kernighan (see external links below).
2071:
only works because the fact that there are no filenames is only checked before
1195:# add one to account for the newline character at the end of each record (line) 978:
as the first character on a line, or behind a command or sequence of commands.
4394: 4292: 3878: 3837: 3640: 3610: 3416:"Awk by example, Part 1: An intro to the great language with the strange name" 2899: 2826: 2515: 2471: 2429:
is a very small, function-only, reentrant, embeddable interpreter written in C
641: 358: 237: 86: 911:
This variable is automatically reset to zero each time a new file is started.
719:), they actually refer to the fields of the current record. A special case, 4585: 4570: 4485: 4470: 4373: 4337: 4307: 4302: 4297: 4167: 4121: 4101: 3998: 3978: 3933: 3781: 3705: 3690: 3675: 3660: 3655: 3650: 3645: 2925: 2775:
James W. Livingston (May 2, 1988). "The Great awk Program is No Birdbrain".
2630: 2624: 1160: 738:
command can also display the results of calculations and/or function calls:
633: 484: 354: 302: 2563: 2159:, published 1988, and its implementation was made available in releases of 2042:
is the name of the command that executed the script, most often the string
172:
awk, GNU Awk, mawk, nawk, MKS AWK, Thompson AWK (compiler), Awka (compiler)
1481:
prints lines of input from the first line matching the regular expression
4526: 4415: 4083: 3863: 3511: 2814:
The awk action language is Turing-complete, and can read and write files.
2759:
Effective Awk Programming: Universal Text Processing and Pattern Matching
2362: 2327: 2275:
as their default AWK implementation. As of version 5.2 (September 2022)
2175: 1485:, that is, a line containing only the phrase "--cut here--", to the end. 327: 3324: 3235: 1650:
This program can be represented in several ways. The first one uses the
448:
AWK was significantly revised and expanded in 1985–88, resulting in the
357:
in the 1970s, and its name is derived from the surnames of its authors:
4536: 3888: 3812: 2597: 2433: 2230: 2222: 2214: 971: 589:
which matches the range of records starting with a record that matches
17: 500: 4389: 3873: 3615: 3540: 3329: 3298: 3264: 2922:"The Single UNIX Specification, Version 3, Utilities Interface Table" 2318:
provides facilities for handling input and output CSV formatted data.
2218: 1780: 1412: 373:. The acronym is pronounced the same as the name of the bird species 213: 3293: 2239: 319:
of textual data – either run directly on files or used as part of a
30:
This article is about the programming language. For other uses, see
2454: 2420: 395:
program that runs scripts written in the AWK programming language.
4475: 4327: 4287: 4282: 4106: 4003: 3983: 3913: 3832: 3735: 3710: 3685: 3635: 3630: 3625: 3620: 3507: 2865:
Aho, Alfred V.; Kernighan, Brian W.; Weinberger, Peter J. (1988).
2226: 1784: 644:, and is now common. The tilde operator was also adopted by Perl. 499: 362: 2840:
Awk — A Pattern Scanning and Processing Language (Second Edition)
4595: 4552: 4480: 4425: 4420: 4317: 4157: 4131: 4067: 3988: 3883: 3868: 3827: 3817: 3761: 3589: 2374: 2348: 716: 637: 518:
An AWK program is a series of pattern action pairs, written as:
489: 469: 408: 388: 294: 233: 229: 4234: 3562: 2447:, based upon the regular expression library of the same author. 1465:, the range will continue until the end of input. For example, 1449:
1 Rome 2 Florence 3 Milan 5 Turin 6 Venice
1431:
is true for the 1st, 5th, 9th, etc., lines of input. Likewise,
4445: 4332: 3958: 3802: 3700: 3456:"Awk by example, Part 3: String functions and ... checkbooks?" 3155:"FreeBSD's work log for importing BWK awk into FreeBSD's core" 2711: 2680: 2370: 2352: 2256: 621: 476: 374: 290: 225: 209: 2326:
is a very fast AWK implementation by Mike Brennan based on a
2038:, the number of arguments, is always guaranteed to be ≥1, as 1797:
checks to see if its left operand matches its right operand;
270: 3501: 1831:'$ 0 ~ pattern { print FILENAME ":" $ 0 }' 1757:'$ 0 ~ ENVIRON { print FILENAME ":" $ 0 }' 4322: 3680: 3129:. Usenix C++ Conference. Washington, DC. pp. 217–228. 1300:
is the number of fields in the current line, e.g. 4. Since
2201:. This version also has features not in the book, such as 3181:"CSV Processing With gawk (using the gawk-csv extension)" 2058:
initiates a comment that expands to the end of the line.
652:
AWK commands are the statements that are substituted for
2746:. Macmillan International Higher Education. p. 196. 2146:
AWK was originally written in 1977 and distributed with
3355:
gawk manual: Other Freely Available awk Implementations
3039:(2nd ed.). Sebastopol, CA: O'Reilly. p. 221. 723:, refers to the entire record. In fact, the commands " 632:
is used for searching. This syntax of using slashes as
3371:"Awk: The Power and Promise of a 40-Year-Old Language" 2355:. Small scripts will turn into programs of 160–170 kB. 3552: 2626:
Effective Awk Programming: A User's Guide for Gnu Awk
285:
designed for text processing and typically used as a
273: 3436:"Awk by example, Part 2: Records, loops, and arrays" 2982:. Charles River Data Systems, Inc. 1983. p. 13. 2461:
gawk manual has a list of more Awk implementations.
2443:
by Michael Parker provides an AWK implementation in
636:
for regular expressions was subsequently adopted by
4604: 4561: 4545: 4517: 4494: 4403: 4382: 4361: 4275: 4140: 4092: 4076: 4055: 4012: 3851: 3795: 3744: 3603: 315:consisting of a set of actions to be taken against 219: 199: 176: 163: 151: 141: 122: 100: 80: 60: 3090: 3088: 2701:"Get started with GAWK: AWK language fundamentals" 2527: 2483: 1787:. The shell script makes an environment variable 2900:"UNIX Special: Profs Kernighan & Brailsford" 2602:(2nd ed.). Sebastopol, CA: O'Reilly Media. 1693:'/ { print FILENAME ":" $ 0 }' 1453:Printing the initial or the final part of a file 569:In addition to a simple AWK expression, such as 3555:The site for things related to the awk language 3000:"The GNU Project and Me: 27 Years with GNU AWK" 506: 369:(who worked on tiny relational databases), and 1724:expands to the original unchanged input line. 990:, function definitions consist of the keyword 923:: Contains the name of the current input-file. 699:Displays the first field of the current record 334:(that is, arrays indexed by key strings), and 4246: 3574: 418:, AWK added computational features to a Unix 383:. When written in all lowercase letters, as 8: 3407: – Interview with Alfred V. Aho on AWK 2952:(Technical report). Linux Foundation. 2008. 2761:(4th ed.). O'Reilly Media. p. 560. 2529:The AWK Programming Language, Second Edition 593:up to and including the record that matches 37: 3478:AWK  – Become an expert in 60 minutes 2167:. This implementation was released under a 1783:function in various standard libraries and 1622:creates a loop that goes through the array 4253: 4239: 4231: 4213: 3581: 3567: 3559: 2993: 2991: 2989: 2949:Linux Standard Base Core Specification 4.0 2770: 2768: 1066:# Outputs '''39''' 1034:This statement can be invoked as follows: 36: 3120:Kernighan, Brian W. (April 24–25, 1991). 3035:Dougherty, Dale; Robbins, Arnold (1997). 661:, which can also provide more functions. 1443:Rome Florence Milan Naples Turin Venice 691:, and these can be displayed separately: 3391:"The A-Z of Programming Languages: AWK" 3062:"The A-Z of Programming Languages: AWK" 2691: 1292:is incremented by the numeric value of 414:As one of the early tools to appear in 377:, which is illustrated on the cover of 342:and was especially designed to support 4687:Pattern matching programming languages 3216:from the original on February 21, 2020 3161:from the original on September 8, 2013 2946:"Chapter 15. Commands and Utilities". 2860: 2858: 624:, which in turn inherited it from the 452:implementation written by Paul Rubin, 4697:Programming languages created in 1977 4677:Domain-specific programming languages 2871:. Addison-Wesley Publishing Company. 2699:Stutz, Michael (September 19, 2006). 2342:(whose front end is written atop the 2261:internationalization and localization 1122:Print lines longer than 80 characters 597:before again trying to match against 7: 3096:"Records (The GNU Awk User's Guide)" 3016:from the original on October 6, 2014 301:, and is a standard feature of most 4712:Text-oriented programming languages 2976:The Insider's Guide To The Universe 2629:(1.0.3 ed.). Bloomington, IN: 1312:. (If the line has no fields, then 338:. While AWK has a limited intended 2647:from the original on 12 April 2009 1304:is the value of the fourth field, 731:" are identical in functionality. 25: 2800:. Case Study: awk. Archived from 2413:application programming interface 2387:is a project to implement AWK in 1771:This is a shell script that uses 4640: 4639: 4212: 4191: 4190: 3466:from the original on 19 May 2009 3389:Hamilton, Naomi (May 30, 2008). 3202:James K. Lawless (May 1, 1997). 3060:Hamilton, Naomi (May 30, 2008). 2910:from the original on 2021-11-22. 2596:; Robbins, Arnold (1997-03-01). 2568:(3rd ed.). Sebastopol, CA: 266: 52: 43: 4682:Free compilers and interpreters 3337:from the original on 2021-08-25 3306:from the original on 2018-06-11 3275:from the original on 2013-04-18 3246:from the original on 2007-05-27 3136:from the original on 2020-06-22 3102:from the original on 2020-06-14 3074:from the original on 2020-02-01 2956:from the original on 2019-10-16 2721:from the original on 2015-04-27 2550:from the original on 2023-10-27 1646:Match pattern from command line 556:is typically an expression and 4722:Unix text processing utilities 3454:Robbins, Daniel (2001-04-01). 3434:Robbins, Daniel (2001-01-01). 2998:Robbins, Arnold (March 2014). 2562:Robbins, Arnold (2001-05-15). 2174:Old versions of Unix, such as 2075:is run! If you explicitly set 1860:awk -v pattern="$ pattern" ... 820:Output may be sent to a file: 1: 3491:The Single UNIX Specification 3204:"Examining the TAWK Compiler" 2742:Andreas J. Pilavakis (1989). 1446:The previous program prints: 2868:The AWK Programming Language 2486:The AWK Programming Language 2156:The AWK Programming Language 2142:Versions and implementations 2129:./print.awk <filename> 2102:with the following content: 1343:Match a range of input lines 1323:At the end of the input the 659:dynamically linked libraries 380:The AWK Programming Language 2798:The Art of Unix Programming 2534:Addison-Wesley Professional 2193:, refers to the version by 612:against a string. As handy 303:Unix-like operating systems 106:; 47 years ago 4738: 3536:"AWK (formerly) at Curlie" 3369:Andy Oram (May 19, 2021). 2087:Self-contained AWK scripts 1858:command line option (e.g. 1489:Calculate word frequencies 29: 4635: 4186: 3525:The Amazing Awk Assembler 2565:Effective awk Programming 2361:(Thompson AWK) is an AWK 1110:"Hello, world!" 894:Other variables include: 496:Structure of AWK programs 430:, and is required by the 428:Single UNIX Specification 289:and reporting tool. Like 224: 204: 183: 171: 137: 118: 51: 42: 3123:An AWK to C++ Translator 2794:"Applying Minilanguages" 2671:Event-driven programming 2623:Robbins, Arnold (2000). 2127:It can be invoked with: 2104: 1868: 1806: 1729: 1656: 1502: 1467: 1346: 1245: 1165: 1128: 1098: 1036: 996: 857: 822: 740: 520: 283:domain-specific language 4672:Cross-platform software 2757:Arnold Robbins (2015). 2532:. Hoboken, New Jersey: 1925:# remove first argument 1094:"Hello, World!" program 986:In a format similar to 711:Although these fields ( 577:, the condition can be 441:operating system under 4717:Unix SUS2008 utilities 4707:Standard Unix programs 4265:command-line interface 4206:Unix SUS2008 utilities 4201:Standard Unix programs 3593:command-line interface 3462:. IBM DeveloperWorks. 3187:. 2018. Archived from 2906:. September 30, 2015. 1092:Here is the customary 982:User-defined functions 872:"expression" 837:"expression" 516: 504: 483:, due to the implicit 308:The AWK language is a 2837:(September 1, 1978). 2676:List of Unix commands 2169:free software license 2050:is the empty string, 1388:"%6d %s\n" 843:"file name" 601:on subsequent lines. 503: 4563:Software development 4094:Software development 3442:. IBM DeveloperWorks 3422:. IBM DeveloperWorks 2835:Weinberger, Peter J. 2524:Weinberger, Peter J. 2480:Weinberger, Peter J. 1327:pattern matches, so 958:Variables and syntax 909:in the current file. 475:AWK was preceded by 130:IEEE Std 1003.1-2008 32:AWK (disambiguation) 27:Programming language 4702:Scripting languages 2831:Kernighan, Brian W. 2666:Data transformation 2520:Kernighan, Brian W. 2476:Kernighan, Brian W. 2269:Linux distributions 1854:Or You can use the 1310:operator precedence 878:"command" 432:Linux Standard Base 387:, it refers to the 353:AWK was created at 336:regular expressions 101:First appeared 39: 3294:"QSEAWK at GitHub" 3209:Dr. Dobb's Journal 1498:associative arrays 1236:words = words + NF 887:Built-in variables 610:regular expression 608:, which matches a 587:pattern1, pattern2 505: 481:one-liner programs 346:, the language is 344:one-liner programs 340:application domain 332:associative arrays 313:scripting language 132:(POSIX) / 1985 4654: 4653: 4228: 4227: 3493:, Version 4 from 3325:"CLAWK at GitHub" 2543:978-0-13-826972-2 2107:#!/usr/bin/awk -f 1619:for (i in words) 1470:/^--cut here--$ / 1234:is shorthand for 443:Bell Laboratories 259: 258: 143:Typing discipline 16:(Redirected from 4729: 4643: 4642: 4383:User environment 4255: 4248: 4241: 4232: 4216: 4215: 4194: 4193: 3796:User environment 3583: 3576: 3569: 3560: 3549: 3544:. Archived from 3505: 3504: 3488: 3487: 3474: 3472: 3471: 3450: 3448: 3447: 3430: 3428: 3427: 3406: 3404: 3403: 3385: 3383: 3381: 3357: 3352: 3346: 3345: 3343: 3342: 3321: 3315: 3314: 3312: 3311: 3290: 3284: 3283: 3281: 3280: 3261: 3255: 3254: 3252: 3251: 3232: 3226: 3225: 3223: 3221: 3199: 3193: 3192: 3177: 3171: 3170: 3168: 3166: 3157:. May 16, 2005. 3151: 3145: 3144: 3142: 3141: 3135: 3128: 3117: 3111: 3110: 3108: 3107: 3092: 3083: 3082: 3080: 3079: 3057: 3051: 3050: 3032: 3026: 3025: 3023: 3021: 3015: 3004: 2995: 2984: 2983: 2981: 2971: 2965: 2964: 2962: 2961: 2943: 2937: 2936: 2934: 2933: 2924:. Archived from 2918: 2912: 2911: 2896: 2890: 2889: 2887: 2885: 2862: 2853: 2852: 2850: 2848: 2823: 2817: 2816: 2811: 2809: 2804:on July 30, 2008 2791:Raymond, Eric S. 2787: 2781: 2780: 2772: 2763: 2762: 2754: 2748: 2747: 2739: 2733: 2732: 2727: 2726: 2720: 2705: 2696: 2655: 2653: 2652: 2619: 2617: 2616: 2589: 2587: 2586: 2558: 2556: 2555: 2511: 2509: 2508: 2490:. New York, NY: 2489: 2303: 2300: 2298: 2296: 2294: 2292: 2290: 2288: 2248: 2245: 2243: 2241: 2208: 2204: 2189:, also known as 2181: 2136: 2130: 2123: 2120: 2117: 2114: 2111: 2108: 2101: 2082: 2078: 2074: 2064: 2057: 2053: 2049: 2045: 2041: 2037: 2033: 2029: 2022: 2019: 2016: 2013: 2010: 2007: 2004: 2001: 1998: 1995: 1992: 1989: 1986: 1983: 1980: 1977: 1974: 1971: 1968: 1965: 1962: 1959: 1956: 1953: 1950: 1947: 1944: 1941: 1938: 1935: 1932: 1929: 1926: 1923: 1920: 1917: 1914: 1911: 1908: 1905: 1902: 1899: 1896: 1893: 1890: 1887: 1884: 1881: 1878: 1875: 1872: 1850: 1847: 1844: 1841: 1838: 1835: 1832: 1828: 1825: 1822: 1819: 1816: 1813: 1810: 1800: 1796: 1790: 1778: 1774: 1767: 1764: 1761: 1758: 1754: 1751: 1748: 1745: 1742: 1739: 1736: 1733: 1723: 1719: 1715: 1710: 1703: 1700: 1697: 1694: 1691: 1688: 1685: 1682: 1678: 1675: 1672: 1669: 1666: 1663: 1660: 1641: 1611: 1608: 1605: 1602: 1599: 1596: 1593: 1590: 1587: 1584: 1581: 1578: 1575: 1572: 1569: 1566: 1563: 1560: 1557: 1554: 1551: 1548: 1545: 1542: 1539: 1536: 1533: 1530: 1527: 1524: 1521: 1518: 1515: 1512: 1509: 1506: 1477: 1474: 1471: 1433:NR % 4 == 3 1429:NR % 4 == 1 1407: 1404: 1401: 1398: 1395: 1392: 1389: 1386: 1383: 1380: 1377: 1374: 1371: 1368: 1365: 1362: 1359: 1356: 1353: 1350: 1285: 1282: 1279: 1276: 1273: 1270: 1267: 1264: 1261: 1258: 1255: 1252: 1249: 1237: 1233: 1226: 1223: 1220: 1217: 1214: 1211: 1208: 1205: 1202: 1199: 1196: 1193: 1190: 1187: 1184: 1181: 1178: 1175: 1172: 1169: 1150: 1147: 1144: 1141: 1138: 1135: 1132: 1117: 1114: 1111: 1108: 1105: 1102: 1096:written in AWK: 1070: 1067: 1064: 1061: 1058: 1055: 1052: 1049: 1046: 1043: 1040: 1030: 1027: 1024: 1021: 1018: 1015: 1012: 1009: 1006: 1003: 1000: 993: 952: 946: 940: 934: 928: 922: 916: 906: 900: 882: 879: 876: 873: 870: 867: 864: 861: 847: 844: 841: 838: 835: 832: 829: 826: 816: 813: 810: 807: 804: 801: 798: 795: 792: 789: 786: 783: 780: 777: 774: 771: 768: 765: 762: 759: 756: 753: 750: 747: 744: 730: 726: 704: 696: 684: 631: 607: 584: 580: 576: 572: 548: 545: 542: 539: 536: 533: 530: 527: 524: 514: 458:Richard Stallman 386: 367:Peter Weinberger 280: 279: 276: 275: 272: 114: 112: 107: 91:Peter Weinberger 82:Designed by 56: 47: 40: 21: 4737: 4736: 4732: 4731: 4730: 4728: 4727: 4726: 4692:Plan 9 commands 4657: 4656: 4655: 4650: 4631: 4600: 4557: 4541: 4513: 4490: 4404:Text processing 4399: 4378: 4357: 4271: 4259: 4229: 4224: 4182: 4136: 4088: 4072: 4051: 4008: 3852:Text processing 3847: 3791: 3740: 3599: 3587: 3534: 3521: 3514:– User Commands 3500: 3499: 3483: 3482: 3469: 3467: 3453: 3445: 3443: 3433: 3425: 3423: 3412:Robbins, Daniel 3410: 3401: 3399: 3388: 3379: 3377: 3368: 3365: 3363:Further reading 3360: 3353: 3349: 3340: 3338: 3323: 3322: 3318: 3309: 3307: 3292: 3291: 3287: 3278: 3276: 3263: 3262: 3258: 3249: 3247: 3240:at SourceForge" 3234: 3233: 3229: 3219: 3217: 3201: 3200: 3196: 3179: 3178: 3174: 3164: 3162: 3153: 3152: 3148: 3139: 3137: 3133: 3126: 3119: 3118: 3114: 3105: 3103: 3094: 3093: 3086: 3077: 3075: 3059: 3058: 3054: 3047: 3034: 3033: 3029: 3019: 3017: 3013: 3002: 2997: 2996: 2987: 2979: 2973: 2972: 2968: 2959: 2957: 2945: 2944: 2940: 2931: 2929: 2920: 2919: 2915: 2898: 2897: 2893: 2883: 2881: 2879: 2864: 2863: 2856: 2846: 2844: 2825: 2824: 2820: 2807: 2805: 2789: 2788: 2784: 2774: 2773: 2766: 2756: 2755: 2751: 2741: 2740: 2736: 2724: 2722: 2718: 2703: 2698: 2697: 2693: 2689: 2662: 2650: 2648: 2641: 2622: 2614: 2612: 2610: 2594:Dougherty, Dale 2592: 2584: 2582: 2580: 2561: 2553: 2551: 2544: 2514: 2506: 2504: 2502: 2470: 2467: 2285: 2238: 2206: 2202: 2195:Brian Kernighan 2179: 2144: 2134: 2128: 2125: 2124: 2121: 2118: 2115: 2112: 2109: 2106: 2099: 2089: 2080: 2076: 2072: 2069: 2062: 2055: 2051: 2047: 2043: 2039: 2035: 2031: 2027: 2024: 2023: 2020: 2017: 2014: 2011: 2008: 2005: 2002: 1999: 1996: 1993: 1990: 1987: 1984: 1981: 1978: 1975: 1972: 1969: 1966: 1963: 1960: 1957: 1954: 1951: 1948: 1945: 1942: 1939: 1936: 1933: 1930: 1927: 1924: 1921: 1918: 1915: 1912: 1909: 1906: 1903: 1900: 1897: 1894: 1891: 1888: 1885: 1882: 1879: 1876: 1873: 1870: 1852: 1851: 1848: 1845: 1842: 1839: 1836: 1833: 1830: 1826: 1823: 1820: 1817: 1814: 1811: 1808: 1798: 1794: 1788: 1776: 1772: 1769: 1768: 1765: 1762: 1759: 1756: 1752: 1749: 1746: 1743: 1740: 1737: 1734: 1731: 1721: 1717: 1713: 1708: 1705: 1704: 1701: 1698: 1695: 1692: 1689: 1686: 1683: 1680: 1676: 1673: 1670: 1667: 1664: 1661: 1658: 1648: 1639: 1620: 1613: 1612: 1609: 1606: 1603: 1600: 1597: 1594: 1591: 1588: 1585: 1582: 1579: 1576: 1573: 1570: 1567: 1564: 1561: 1558: 1555: 1552: 1549: 1546: 1543: 1540: 1537: 1534: 1531: 1528: 1525: 1522: 1519: 1516: 1513: 1510: 1507: 1504: 1491: 1483:^--cut here--$ 1479: 1478: 1475: 1472: 1469: 1455: 1450: 1444: 1409: 1408: 1405: 1402: 1399: 1396: 1393: 1390: 1387: 1384: 1381: 1378: 1375: 1372: 1369: 1366: 1363: 1360: 1357: 1354: 1351: 1348: 1345: 1287: 1286: 1283: 1280: 1277: 1274: 1271: 1268: 1265: 1262: 1259: 1256: 1253: 1250: 1247: 1244: 1235: 1231: 1228: 1227: 1224: 1221: 1218: 1215: 1212: 1209: 1206: 1203: 1200: 1197: 1194: 1191: 1188: 1185: 1182: 1179: 1176: 1173: 1170: 1167: 1157: 1152: 1151: 1148: 1145: 1142: 1139: 1136: 1133: 1130: 1124: 1119: 1118: 1115: 1112: 1109: 1106: 1103: 1100: 1090: 1085: 1072: 1071: 1068: 1065: 1062: 1059: 1056: 1053: 1050: 1047: 1044: 1041: 1038: 1032: 1031: 1028: 1025: 1022: 1019: 1016: 1013: 1010: 1007: 1004: 1001: 998: 991: 984: 960: 950: 944: 938: 932: 926: 920: 914: 904: 898: 889: 884: 883: 880: 877: 874: 871: 868: 865: 862: 860:/regex_pattern/ 859: 849: 848: 845: 842: 839: 836: 833: 830: 827: 825:/regex_pattern/ 824: 818: 817: 814: 811: 808: 805: 802: 799: 796: 793: 790: 787: 784: 781: 778: 775: 772: 769: 766: 763: 760: 757: 754: 751: 748: 745: 743:/regex_pattern/ 742: 728: 724: 702: 694: 682: 671: 650: 629: 628:editor, where 614:syntactic sugar 605: 582: 578: 574: 570: 550: 549: 546: 543: 540: 537: 534: 531: 528: 525: 522: 515: 512: 498: 466:Brian Kernighan 434:specification. 401: 384: 371:Brian Kernighan 348:Turing-complete 287:data extraction 269: 265: 166:implementations 133: 110: 108: 105: 95:Brian Kernighan 35: 28: 23: 22: 15: 12: 11: 5: 4735: 4733: 4725: 4724: 4719: 4714: 4709: 4704: 4699: 4694: 4689: 4684: 4679: 4674: 4669: 4659: 4658: 4652: 4651: 4649: 4648: 4636: 4633: 4632: 4630: 4629: 4624: 4619: 4614: 4608: 4606: 4602: 4601: 4599: 4598: 4593: 4588: 4583: 4578: 4573: 4567: 4565: 4559: 4558: 4556: 4555: 4549: 4547: 4543: 4542: 4540: 4539: 4534: 4529: 4523: 4521: 4515: 4514: 4512: 4511: 4506: 4500: 4498: 4496:Shell builtins 4492: 4491: 4489: 4488: 4483: 4478: 4473: 4468: 4463: 4458: 4453: 4448: 4443: 4438: 4433: 4428: 4423: 4418: 4413: 4407: 4405: 4401: 4400: 4398: 4397: 4392: 4386: 4384: 4380: 4379: 4377: 4376: 4371: 4365: 4363: 4359: 4358: 4356: 4355: 4350: 4345: 4340: 4335: 4330: 4325: 4320: 4315: 4310: 4305: 4300: 4295: 4290: 4285: 4279: 4277: 4273: 4272: 4269:shell builtins 4260: 4258: 4257: 4250: 4243: 4235: 4226: 4225: 4223: 4222: 4210: 4209: 4208: 4203: 4187: 4184: 4183: 4181: 4180: 4178:true and false 4175: 4170: 4165: 4160: 4155: 4150: 4144: 4142: 4138: 4137: 4135: 4134: 4129: 4124: 4119: 4114: 4109: 4104: 4098: 4096: 4090: 4089: 4087: 4086: 4080: 4078: 4074: 4073: 4071: 4070: 4065: 4059: 4057: 4053: 4052: 4050: 4049: 4044: 4039: 4034: 4029: 4024: 4018: 4016: 4014:Shell builtins 4010: 4009: 4007: 4006: 4001: 3996: 3991: 3986: 3981: 3976: 3971: 3966: 3961: 3956: 3951: 3946: 3941: 3936: 3931: 3926: 3921: 3916: 3911: 3906: 3901: 3896: 3891: 3886: 3881: 3876: 3871: 3866: 3861: 3855: 3853: 3849: 3848: 3846: 3845: 3840: 3835: 3830: 3825: 3820: 3815: 3810: 3805: 3799: 3797: 3793: 3792: 3790: 3789: 3784: 3779: 3774: 3769: 3764: 3759: 3754: 3748: 3746: 3742: 3741: 3739: 3738: 3733: 3728: 3723: 3718: 3713: 3708: 3703: 3698: 3693: 3688: 3683: 3678: 3673: 3668: 3663: 3658: 3653: 3648: 3643: 3638: 3633: 3628: 3623: 3618: 3613: 3607: 3605: 3601: 3600: 3597:shell builtins 3588: 3586: 3585: 3578: 3571: 3563: 3557: 3556: 3550: 3548:on 2022-03-18. 3532: 3520: 3519:External links 3517: 3516: 3515: 3497: 3495:The Open Group 3480: 3475: 3460:Common threads 3451: 3440:Common threads 3431: 3420:Common threads 3414:(2000-12-01). 3408: 3386: 3364: 3361: 3359: 3358: 3347: 3316: 3285: 3256: 3227: 3194: 3191:on 2020-03-25. 3172: 3146: 3112: 3084: 3052: 3045: 3027: 2985: 2966: 2938: 2913: 2891: 2877: 2854: 2827:Aho, Alfred V. 2818: 2782: 2777:Digital Review 2764: 2749: 2734: 2708:developerWorks 2690: 2688: 2685: 2684: 2683: 2678: 2673: 2668: 2661: 2658: 2657: 2656: 2639: 2620: 2608: 2590: 2578: 2570:O'Reilly Media 2559: 2542: 2526:(2023-09-06). 2516:Aho, Alfred V. 2512: 2500: 2492:Addison-Wesley 2482:(1988-01-01). 2472:Aho, Alfred V. 2466: 2463: 2459: 2458: 2448: 2438: 2430: 2424: 2406: 2401:that extends 2392: 2382: 2356: 2337: 2331: 2321: 2320: 2319: 2250: 2148:Version 7 Unix 2143: 2140: 2105: 2088: 2085: 2067: 1869: 1834:"pattern= 1807: 1730: 1657: 1647: 1644: 1618: 1503: 1494:Word frequency 1490: 1487: 1468: 1454: 1451: 1448: 1442: 1347: 1344: 1341: 1246: 1243: 1240: 1166: 1156: 1153: 1129: 1123: 1120: 1099: 1089: 1086: 1084: 1081: 1037: 997: 983: 980: 959: 956: 955: 954: 948: 942: 936: 930: 924: 918: 912: 902: 888: 885: 858: 823: 741: 709: 708: 705: 703:print $ 1, $ 3 700: 697: 692: 685: 670: 663: 649: 646: 521: 510: 497: 494: 462:Arnold Robbins 416:Version 7 Unix 400: 397: 257: 256: 222: 221: 217: 216: 202: 201: 197: 196: 181: 180: 174: 173: 169: 168: 161: 160: 158:Cross-platform 155: 149: 148: 145: 139: 138: 135: 134: 128: 126: 124:Stable release 120: 119: 116: 115: 102: 98: 97: 84: 78: 77: 64: 58: 57: 49: 48: 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 4734: 4723: 4720: 4718: 4715: 4713: 4710: 4708: 4705: 4703: 4700: 4698: 4695: 4693: 4690: 4688: 4685: 4683: 4680: 4678: 4675: 4673: 4670: 4668: 4667:1977 software 4665: 4664: 4662: 4647: 4638: 4637: 4634: 4628: 4625: 4623: 4620: 4618: 4615: 4613: 4610: 4609: 4607: 4605:Miscellaneous 4603: 4597: 4594: 4592: 4589: 4587: 4584: 4582: 4579: 4577: 4574: 4572: 4569: 4568: 4566: 4564: 4560: 4554: 4551: 4550: 4548: 4544: 4538: 4535: 4533: 4530: 4528: 4525: 4524: 4522: 4520: 4516: 4510: 4507: 4505: 4502: 4501: 4499: 4497: 4493: 4487: 4484: 4482: 4479: 4477: 4474: 4472: 4469: 4467: 4464: 4462: 4459: 4457: 4454: 4452: 4449: 4447: 4444: 4442: 4439: 4437: 4434: 4432: 4429: 4427: 4424: 4422: 4419: 4417: 4414: 4412: 4409: 4408: 4406: 4402: 4396: 4393: 4391: 4388: 4387: 4385: 4381: 4375: 4372: 4370: 4367: 4366: 4364: 4360: 4354: 4351: 4349: 4346: 4344: 4341: 4339: 4336: 4334: 4331: 4329: 4326: 4324: 4321: 4319: 4316: 4314: 4311: 4309: 4306: 4304: 4301: 4299: 4296: 4294: 4291: 4289: 4286: 4284: 4281: 4280: 4278: 4274: 4270: 4267:programs and 4266: 4263: 4256: 4251: 4249: 4244: 4242: 4237: 4236: 4233: 4221: 4220: 4211: 4207: 4204: 4202: 4199: 4198: 4197: 4189: 4188: 4185: 4179: 4176: 4174: 4171: 4169: 4166: 4164: 4161: 4159: 4156: 4154: 4151: 4149: 4146: 4145: 4143: 4141:Miscellaneous 4139: 4133: 4130: 4128: 4125: 4123: 4120: 4118: 4115: 4113: 4110: 4108: 4105: 4103: 4100: 4099: 4097: 4095: 4091: 4085: 4082: 4081: 4079: 4077:Documentation 4075: 4069: 4066: 4064: 4061: 4060: 4058: 4054: 4048: 4045: 4043: 4040: 4038: 4035: 4033: 4030: 4028: 4025: 4023: 4020: 4019: 4017: 4015: 4011: 4005: 4002: 4000: 3997: 3995: 3992: 3990: 3987: 3985: 3982: 3980: 3977: 3975: 3972: 3970: 3967: 3965: 3962: 3960: 3957: 3955: 3952: 3950: 3947: 3945: 3942: 3940: 3937: 3935: 3932: 3930: 3927: 3925: 3922: 3920: 3917: 3915: 3912: 3910: 3907: 3905: 3902: 3900: 3897: 3895: 3892: 3890: 3887: 3885: 3882: 3880: 3877: 3875: 3872: 3870: 3867: 3865: 3862: 3860: 3857: 3856: 3854: 3850: 3844: 3841: 3839: 3836: 3834: 3831: 3829: 3826: 3824: 3821: 3819: 3816: 3814: 3811: 3809: 3806: 3804: 3801: 3800: 3798: 3794: 3788: 3785: 3783: 3780: 3778: 3775: 3773: 3770: 3768: 3765: 3763: 3760: 3758: 3755: 3753: 3750: 3749: 3747: 3743: 3737: 3734: 3732: 3729: 3727: 3724: 3722: 3719: 3717: 3714: 3712: 3709: 3707: 3704: 3702: 3699: 3697: 3694: 3692: 3689: 3687: 3684: 3682: 3679: 3677: 3674: 3672: 3669: 3667: 3664: 3662: 3659: 3657: 3654: 3652: 3649: 3647: 3644: 3642: 3639: 3637: 3634: 3632: 3629: 3627: 3624: 3622: 3619: 3617: 3614: 3612: 3609: 3608: 3606: 3602: 3598: 3595:programs and 3594: 3591: 3584: 3579: 3577: 3572: 3570: 3565: 3564: 3561: 3554: 3551: 3547: 3543: 3542: 3537: 3533: 3530: 3529:Henry Spencer 3526: 3523: 3522: 3518: 3513: 3509: 3506: –  3503: 3498: 3496: 3492: 3486: 3481: 3479: 3476: 3465: 3461: 3457: 3452: 3441: 3437: 3432: 3421: 3417: 3413: 3409: 3398: 3397: 3396:Computerworld 3392: 3387: 3376: 3372: 3367: 3366: 3362: 3356: 3351: 3348: 3336: 3332: 3331: 3326: 3320: 3317: 3305: 3301: 3300: 3295: 3289: 3286: 3274: 3270: 3268: 3260: 3257: 3245: 3241: 3239: 3231: 3228: 3215: 3211: 3210: 3205: 3198: 3195: 3190: 3186: 3182: 3176: 3173: 3165:September 20, 3160: 3156: 3150: 3147: 3132: 3125: 3124: 3116: 3113: 3101: 3097: 3091: 3089: 3085: 3073: 3069: 3068: 3067:Computerworld 3063: 3056: 3053: 3048: 3046:1-565-92225-5 3042: 3038: 3037:sed & awk 3031: 3028: 3012: 3008: 3001: 2994: 2992: 2990: 2986: 2978: 2977: 2970: 2967: 2955: 2951: 2950: 2942: 2939: 2928:on 2018-01-05 2927: 2923: 2917: 2914: 2909: 2905: 2904:Computerphile 2901: 2895: 2892: 2880: 2878:9780201079814 2874: 2870: 2869: 2861: 2859: 2855: 2842: 2841: 2836: 2832: 2828: 2822: 2819: 2815: 2803: 2799: 2795: 2792: 2786: 2783: 2779:. p. 91. 2778: 2771: 2769: 2765: 2760: 2753: 2750: 2745: 2744:UNIX Workshop 2738: 2735: 2731: 2717: 2713: 2709: 2702: 2695: 2692: 2686: 2682: 2679: 2677: 2674: 2672: 2669: 2667: 2664: 2663: 2659: 2646: 2642: 2640:0-595-10034-1 2636: 2632: 2628: 2627: 2621: 2611: 2609:1-56592-225-5 2605: 2601: 2600: 2599:sed & awk 2595: 2591: 2581: 2579:0-596-00070-7 2575: 2571: 2567: 2566: 2560: 2549: 2545: 2539: 2535: 2531: 2530: 2525: 2521: 2517: 2513: 2503: 2501:0-201-07981-X 2497: 2493: 2488: 2487: 2481: 2477: 2473: 2469: 2468: 2464: 2462: 2456: 2452: 2449: 2446: 2442: 2439: 2436: 2435: 2431: 2428: 2425: 2422: 2418: 2414: 2410: 2407: 2404: 2400: 2397:is a fork of 2396: 2393: 2390: 2386: 2383: 2380: 2376: 2372: 2368: 2364: 2360: 2357: 2354: 2350: 2345: 2341: 2338: 2335: 2332: 2329: 2325: 2322: 2317: 2314:extension of 2313: 2309: 2306: 2305: 2302: 2284:User Manual: 2283: 2278: 2274: 2270: 2266: 2262: 2258: 2254: 2251: 2247: 2236: 2232: 2228: 2224: 2220: 2216: 2212: 2200: 2196: 2192: 2188: 2185: 2184: 2183: 2177: 2172: 2170: 2166: 2162: 2161:UNIX System V 2158: 2157: 2151: 2149: 2141: 2139: 2131: 2103: 2096: 2094: 2086: 2084: 2066: 2059: 2012:":" 1982:"-" 1867: 1863: 1861: 1857: 1805: 1802: 1792: 1786: 1782: 1728: 1725: 1655: 1653: 1645: 1643: 1637: 1633: 1629: 1625: 1617: 1517:"+" 1501: 1499: 1495: 1488: 1486: 1484: 1466: 1464: 1460: 1452: 1447: 1441: 1437: 1434: 1430: 1426: 1422: 1418: 1414: 1342: 1340: 1338: 1334: 1330: 1326: 1321: 1319: 1315: 1311: 1307: 1303: 1299: 1295: 1291: 1242:Sum last word 1241: 1239: 1164: 1162: 1154: 1127: 1121: 1097: 1095: 1088:Hello, World! 1087: 1082: 1080: 1078: 1035: 995: 989: 981: 979: 977: 973: 969: 968:concatenation 965: 957: 949: 943: 937: 931: 925: 919: 913: 910: 903: 897: 896: 895: 892: 886: 856: 854: 851:or through a 821: 739: 737: 732: 722: 718: 714: 706: 701: 698: 693: 690: 686: 681: 680: 679: 676: 668: 664: 662: 660: 655: 647: 645: 643: 639: 635: 627: 623: 619: 615: 611: 602: 600: 596: 592: 588: 567: 564: 559: 555: 519: 513:Alfred V. Aho 509: 502: 495: 493: 491: 486: 482: 478: 473: 471: 467: 463: 459: 455: 451: 446: 444: 440: 435: 433: 429: 425: 421: 417: 412: 410: 406: 405:Marc Rochkind 398: 396: 394: 390: 382: 381: 376: 372: 368: 364: 360: 356: 351: 349: 345: 341: 337: 333: 329: 326: 322: 318: 314: 311: 306: 304: 300: 296: 292: 288: 284: 278: 263: 255: 251: 247: 243: 239: 235: 231: 227: 223: 218: 215: 211: 207: 203: 200:Influenced by 198: 194: 190: 186: 182: 179: 175: 170: 167: 162: 159: 156: 154: 150: 146: 144: 140: 136: 131: 127: 125: 121: 117: 103: 99: 96: 92: 88: 85: 83: 79: 76: 72: 68: 65: 63: 59: 55: 50: 46: 41: 33: 19: 4410: 4217: 4195: 3858: 3546:the original 3539: 3468:. Retrieved 3459: 3444:. Retrieved 3439: 3424:. Retrieved 3419: 3400:. Retrieved 3394: 3378:. Retrieved 3374: 3350: 3339:. Retrieved 3328: 3319: 3308:. Retrieved 3297: 3288: 3277:. Retrieved 3266: 3259: 3248:. Retrieved 3237: 3230: 3220:February 21, 3218:. Retrieved 3207: 3197: 3189:the original 3184: 3175: 3163:. Retrieved 3149: 3138:. Retrieved 3122: 3115: 3104:. Retrieved 3076:. Retrieved 3065: 3055: 3036: 3030: 3018:. Retrieved 3006: 2975: 2969: 2958:. Retrieved 2948: 2941: 2930:. Retrieved 2926:the original 2916: 2903: 2894: 2882:. Retrieved 2867: 2845:. Retrieved 2839: 2821: 2813: 2806:. Retrieved 2802:the original 2797: 2785: 2776: 2758: 2752: 2743: 2737: 2729: 2723:. Retrieved 2707: 2694: 2649:. Retrieved 2625: 2613:. Retrieved 2598: 2583:. Retrieved 2564: 2552:. Retrieved 2528: 2505:. Retrieved 2485: 2460: 2450: 2440: 2432: 2426: 2408: 2402: 2398: 2394: 2384: 2358: 2343: 2339: 2333: 2330:interpreter. 2323: 2315: 2307: 2281: 2276: 2272: 2252: 2234: 2199:one-true-awk 2198: 2190: 2186: 2173: 2164: 2154: 2152: 2145: 2132: 2126: 2097: 2090: 2070: 2060: 2034:block ends. 2025: 1864: 1859: 1856:-v var=value 1855: 1853: 1803: 1793: 1770: 1726: 1706: 1652:Bourne shell 1649: 1635: 1631: 1627: 1623: 1621: 1614: 1492: 1482: 1480: 1462: 1458: 1456: 1445: 1438: 1432: 1428: 1420: 1416: 1410: 1336: 1332: 1328: 1324: 1322: 1317: 1313: 1305: 1301: 1297: 1293: 1289: 1288: 1229: 1158: 1125: 1091: 1073: 1033: 985: 975: 963: 961: 908: 893: 890: 850: 819: 735: 733: 720: 712: 710: 688: 674: 672: 666: 653: 651: 617: 603: 598: 594: 590: 586: 568: 562: 557: 553: 551: 517: 507: 474: 464:since 1994. 454:Jay Fenlason 447: 436: 424:Bourne shell 422:besides the 413: 402: 378: 352: 307: 261: 260: 249: 245: 241: 192: 188: 184: 4527:ip/ipconfig 4276:File system 3604:File system 3553:awklang.org 2847:February 1, 2445:Common Lisp 2244:/onetrueawk 2178:, included 2068:awk 'prog' 1716:) matches. 1681:'/' 1232:words += NF 1155:Count words 361:(author of 310:data-driven 191:nawk 1985, 187:oawk 1977, 75:data-driven 4661:Categories 4519:Networking 4196:Categories 3470:2009-04-16 3446:2009-04-16 3426:2009-04-16 3402:2008-12-12 3341:2021-06-01 3310:2017-09-06 3279:2013-05-07 3269:Home Page" 3250:2006-08-23 3185:gawkextlib 3140:2020-02-01 3106:2020-05-23 3078:2008-12-12 3020:October 4, 3007:skeeve.com 2960:2020-02-01 2932:2005-12-18 2725:2015-01-29 2687:References 2651:2009-04-16 2615:2009-04-16 2585:2009-04-16 2554:2023-11-03 2507:2017-01-22 2415:(API) for 1626:, setting 1427:operator. 1077:whitespace 642:ECMAScript 634:delimiters 359:Alfred Aho 297:, it is a 238:Korn Shell 220:Influenced 87:Alfred Aho 71:procedural 4546:Searching 4362:Processes 4056:Searching 3745:Processes 2631:iUniverse 2293:/software 2100:print.awk 2061:Note the 1837:$ pattern 1809:#!/bin/sh 1732:#!/bin/sh 1709:$ pattern 1687:$ pattern 1659:#!/bin/sh 1632:subscript 1054:add_three 1002:add_three 729:print $ 0 695:print $ 1 554:condition 535:condition 523:condition 485:main loop 445:license. 355:Bell Labs 67:Scripting 4646:Category 4416:basename 3864:basename 3464:Archived 3375:Fosslife 3335:Archived 3304:Archived 3273:Archived 3244:Archived 3214:Archived 3159:Archived 3131:Archived 3100:Archived 3072:Archived 3011:Archived 2954:Archived 2908:Archived 2716:Archived 2660:See also 2645:Archived 2548:Archived 2363:compiler 2328:bytecode 2308:gawk-csv 2299:/pm-gawk 2271:include 2265:profiler 2176:UNIX/32V 2095:syntax. 2009:FILENAME 1718:FILENAME 1630:to each 1083:Examples 999:function 992:function 921:FILENAME 788:variable 648:Commands 618:/regexp/ 599:pattern1 595:pattern2 591:pattern1 571:foo == 1 511:—  420:pipeline 328:datatype 321:pipeline 178:Dialects 62:Paradigm 4622:fortune 4537:netstat 4532:ip/ping 4461:strings 3969:strings 3889:dirname 3813:logname 3762:crontab 3502:gawk(1) 3380:June 9, 2808:May 11, 2434:BusyBox 2427:libfawk 2379:Windows 2367:Solaris 2334:libmawk 2297:/manual 2231:illumos 2223:OpenBSD 2215:FreeBSD 2211:Android 2207:ENVIRON 2203:tolower 2187:BWK awk 2093:shebang 2000:pattern 1877:pattern 1812:pattern 1789:pattern 1777:ENVIRON 1773:ENVIRON 1738:pattern 1662:pattern 1640:tolower 1423:is the 1042:pattern 972:delimit 964:+ - * / 727:" and " 669:command 450:GNU AWK 399:History 317:streams 281:) is a 193:GNU Awk 189:new awk 185:old awk 109: ( 18:GNU Awk 4644:  4390:passwd 4262:Plan 9 3949:printf 3874:csplit 3616:chattr 3541:Curlie 3512:Manual 3330:GitHub 3299:GitHub 3043:  2884:16 May 2875:  2637:  2606:  2576:  2540:  2498:  2455:Github 2409:QSEAWK 2377:, and 2310:. The 2240:github 2229:, and 2219:NetBSD 1849:" 1843:" 1840:" 1824:" 1818:" 1781:getenv 1766:" 1760:" 1750:" 1744:" 1735:export 1702:" 1696:" 1690:" 1684:" 1674:" 1668:" 1496:using 1425:modulo 1413:printf 1385:printf 1316:is 0, 1186:length 1131:length 1020:number 1017:return 1008:number 782:foobar 767:foobar 689:fields 654:action 575:/^foo/ 563:action 558:action 552:where 541:action 529:action 456:, and 393:Plan 9 325:string 299:filter 214:SNOBOL 164:Major 93:, and 4627:sleep 4591:strip 4476:troff 4456:spell 4353:touch 4343:split 4328:mkdir 4288:chgrp 4283:chmod 4173:sleep 4127:strip 4107:ctags 4042:unset 4022:alias 4004:xargs 3984:troff 3944:patch 3939:paste 3914:iconv 3843:write 3833:uname 3736:umask 3726:touch 3716:split 3711:rmdir 3686:mkdir 3671:fuser 3636:cksum 3631:chgrp 3626:chown 3621:chmod 3510:User 3508:Linux 3267:xgawk 3134:(PDF) 3127:(PDF) 3014:(PDF) 3003:(PDF) 2980:(PDF) 2719:(PDF) 2704:(PDF) 2465:Books 2451:goawk 2441:CLAWK 2395:xgawk 2351:, or 2316:gawk 2295:/gawk 2227:macOS 2180:awkcc 2113:print 2044:"awk" 2032:BEGIN 2028:BEGIN 2006:print 1871:BEGIN 1827:shift 1785:POSIX 1753:shift 1677:shift 1636:value 1624:words 1607:words 1598:print 1592:words 1565:words 1547:<= 1505:BEGIN 1272:print 1222:chars 1216:words 1207:print 1180:chars 1171:words 1107:print 1101:BEGIN 1051:print 869:print 834:print 794:print 779:print 764:print 752:print 736:print 725:print 683:print 675:print 667:print 579:BEGIN 363:egrep 246:dtksh 242:ksh93 4596:yacc 4553:grep 4509:test 4504:echo 4481:uniq 4466:tail 4451:sort 4441:join 4426:diff 4421:comm 4369:kill 4318:gzip 4313:file 4219:List 4158:expr 4132:yacc 4117:make 4068:grep 4063:find 4047:wait 4037:test 4032:echo 3989:uniq 3974:tail 3964:sort 3954:read 3929:more 3919:join 3909:head 3904:fold 3884:diff 3869:comm 3828:tput 3823:talk 3818:mesg 3808:exit 3787:time 3777:nice 3772:kill 3731:type 3666:file 3590:Unix 3382:2021 3238:Jawk 3222:2020 3167:2006 3041:ISBN 3022:2014 2886:2015 2873:ISBN 2849:2020 2810:2010 2635:ISBN 2604:ISBN 2574:ISBN 2538:ISBN 2496:ISBN 2419:and 2403:gawk 2399:gawk 2389:Java 2385:Jawk 2375:OS/2 2365:for 2359:tawk 2349:Perl 2344:mawk 2340:awka 2324:mawk 2291:.org 2289:.gnu 2282:gawk 2277:gawk 2273:gawk 2253:gawk 2246:/awk 2242:.com 2235:nawk 2205:and 2191:nawk 2165:nawk 2133:The 2077:ARGC 2073:prog 2048:ARGV 2040:ARGV 2036:ARGC 2026:The 1976:ARGV 1967:ARGC 1949:ARGC 1937:ARGC 1934:ARGV 1928:ARGV 1910:ARGC 1907:< 1883:ARGV 1707:The 1337:s "" 1306:$ NF 1294:$ NF 1146:> 1113:exit 951:OFMT 853:pipe 840:> 734:The 717:Perl 673:The 665:The 640:and 638:Perl 490:Perl 470:nawk 439:UNOS 409:yacc 389:Unix 295:grep 293:and 250:tksh 234:Perl 230:AMPL 195:gawk 111:1977 104:1977 4617:cal 4581:lex 4576:hoc 4446:sed 4436:eqn 4411:awk 4395:who 4348:tee 4333:pwd 4293:cmp 4153:cal 4112:lex 4084:man 3959:sed 3879:cut 3859:awk 3838:who 3803:env 3721:tee 3701:pwd 3696:pax 3641:cmp 3611:cat 3527:by 3485:awk 2712:IBM 2681:sed 2421:C++ 2371:DOS 2353:Tcl 2312:CSV 2287:www 2257:GNU 1886:for 1862:). 1846:$ @ 1829:awk 1821:$ 1 1763:$ @ 1755:awk 1747:$ 1 1722:$ 0 1714:$ 0 1699:$ @ 1679:awk 1671:$ 1 1580:for 1574:END 1526:for 1325:END 1318:$ 0 1302:$ 4 1266:END 1201:END 1163:): 945:ORS 939:OFS 905:FNR 797:sin 721:$ 0 713:$ X 622:sed 583:END 581:or 573:or 547:... 477:sed 468:'s 391:or 385:awk 375:auk 365:), 291:sed 262:AWK 254:Lua 252:), 226:Tcl 210:sed 38:AWK 4663:: 4612:bc 4586:nm 4571:ar 4486:wc 4471:tr 4431:ed 4374:ps 4338:rm 4323:ls 4308:du 4303:dd 4298:cp 4168:od 4163:lp 4148:bc 4122:nm 4102:ar 4027:cd 3999:wc 3994:vi 3979:tr 3934:nl 3924:m4 3899:ex 3894:ed 3782:ps 3767:fg 3757:bg 3752:at 3706:rm 3691:mv 3681:ls 3676:ln 3661:df 3656:du 3651:dd 3646:cp 3538:. 3458:. 3438:. 3418:. 3393:. 3373:. 3333:. 3327:. 3302:. 3296:. 3271:. 3242:. 3212:. 3206:. 3183:. 3098:. 3087:^ 3070:. 3064:. 3009:. 3005:. 2988:^ 2902:. 2857:^ 2833:; 2829:; 2812:. 2796:. 2767:^ 2728:. 2714:. 2710:. 2706:. 2643:. 2633:. 2572:. 2546:. 2536:. 2522:; 2518:; 2494:. 2478:; 2474:; 2373:, 2369:, 2304:. 2237:: 2225:, 2221:, 2217:, 2213:, 2150:. 2135:-f 2116:$ 2083:. 2063:if 2054:. 2052:"" 2046:. 2015:$ 1991:$ 1952:== 1943:if 1940:-- 1919:++ 1799:!~ 1589:in 1568:++ 1559:++ 1550:NF 1511:FS 1500:: 1417:NR 1400:$ 1394:NR 1376:== 1367:NR 1358:== 1349:NR 1314:NF 1298:NF 1260:NF 1257:$ 1254:+= 1238:. 1210:NR 1183:+= 1177:NF 1174:+= 1161:wc 1149:80 1137:$ 1060:36 933:RS 927:FS 915:NF 899:NR 855:: 626:ed 616:, 411:. 330:, 305:. 271:ɔː 248:, 244:, 236:, 232:, 228:, 212:, 208:, 153:OS 89:, 73:, 69:, 4254:e 4247:t 4240:v 3582:e 3575:t 3568:v 3531:. 3473:. 3449:. 3429:. 3405:. 3384:. 3344:. 3313:. 3282:. 3265:" 3253:. 3236:" 3224:. 3169:. 3143:. 3109:. 3081:. 3049:. 3024:. 2963:. 2935:. 2888:. 2851:. 2654:. 2618:. 2588:. 2557:. 2510:. 2457:. 2423:. 2417:C 2301:/ 2255:( 2249:. 2122:} 2119:0 2110:{ 2081:- 2056:# 2021:} 2018:0 2003:{ 1997:~ 1994:0 1988:} 1985:} 1979:= 1973:2 1970:= 1961:{ 1958:) 1955:1 1946:( 1931:= 1922:) 1916:i 1913:; 1904:i 1901:; 1898:1 1895:= 1892:i 1889:( 1880:= 1874:{ 1815:= 1795:~ 1741:= 1712:( 1665:= 1628:i 1610:} 1604:, 1601:i 1595:) 1586:i 1583:( 1577:{ 1571:} 1562:) 1556:i 1553:; 1544:i 1541:; 1538:1 1535:= 1532:i 1529:( 1523:{ 1520:} 1514:= 1508:{ 1476:0 1473:, 1463:0 1459:1 1421:% 1406:} 1403:0 1397:, 1391:, 1382:{ 1379:3 1373:4 1370:% 1364:, 1361:1 1355:4 1352:% 1333:s 1329:s 1290:s 1284:} 1281:0 1278:+ 1275:s 1269:{ 1263:} 1251:s 1248:{ 1225:} 1219:, 1213:, 1204:{ 1198:} 1192:1 1189:+ 1168:{ 1143:) 1140:0 1134:( 1116:} 1104:{ 1069:} 1063:) 1057:( 1048:{ 1045:) 1039:( 1029:} 1026:3 1023:+ 1014:{ 1011:) 1005:( 988:C 976:# 881:} 875:| 863:{ 846:} 828:{ 815:} 812:) 809:2 806:- 803:3 800:( 791:) 785:( 776:) 773:3 770:( 761:2 758:+ 755:3 746:{ 630:/ 606:~ 544:} 538:{ 532:} 526:{ 277:/ 274:k 268:/ 264:( 240:( 206:C 113:) 34:. 20:)

Index

GNU Awk
AWK (disambiguation)


Paradigm
Scripting
procedural
data-driven
Designed by
Alfred Aho
Peter Weinberger
Brian Kernighan
Stable release
IEEE Std 1003.1-2008
Typing discipline
OS
Cross-platform
implementations
Dialects
C
sed
SNOBOL
Tcl
AMPL
Perl
Korn Shell
Lua
/ɔːk/
domain-specific language
data extraction

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.