awk1page
an awk program is a series of //pattern { actions }// statements;\\ ie if the input line matchs pattern . . .
2K - last updated 2012-03-18 22:22 UTC by g0pher
AwkGuide
** Work in Progress ** {{{ import from Mark Hobley's wiki }}} <toc> ---- == Overview * [[Overview]] . . . * [[division]] * [[doublequotes]] * [[empty statement]] * [[empty string]] * [[END]] * [[enumeration]] . . . [[search pattern]]s * [[special variable]]s * [[statement]]s * [[string]]s * [[string manipulation]] . . .
4K - last updated 2011-08-14 15:57 UTC by markhobley
AwkTips
<toc> ---- == Be idiomatic! In this paragraph, we give some hints on how to write more idiomatic . . . inside braces). **print $0** is a redundant statement, since **print** alone, by default, prints . . . some administrative data, we use the "next" statement to tell awk to immediately start processing . . . thing, but insted of using an explicit printf statement it sets a different value for ORS depending . . .
31K - last updated 2009-03-24 16:54 UTC by waldner
brace
== Enclosure of actions == In [[awk]], squiggly braces are used as [[enclosure]]s around [[action]]s . . . within the [[rule]]s: == Grouping of statements == Braces can also be used to create a [[block]] . . . of [[statement]]s within an action: . . .
1K - last updated 2010-11-10 22:41 UTC by markhobley
continuation
Line continuation enables long lines of code to split across several lines for the purpose of making . . . used as a continuation character, enabling a [[statement]] to be split across several lines: {{{ BEGIN . . . { # The backslash symbol can be used to spread a statement across several lines print \ "Hello World!" . . . characters must be appropriately placed within a statement === In awk, a continuation character should . . .
1K - last updated 2011-05-09 22:48 UTC by markhobley
control structure
'''Control structures''' are constructs used to control the logic of a program based on a given condition. . . . structures typically use [[branch]] or [[loop]] statements. Code is typically arranged into [[block]]s . . .
1K - last updated 2011-06-25 05:08 UTC by pgas
Features of awk
The [[awk]] utility: * treats lines of a text as database records, which can be divided into fields. . . . supports multiple [[assignment]]s from a single statement * the [[hashbang]] mechanism requires a switch . . .
1K - last updated 2011-05-27 15:33 UTC by markhobley
Genius
http://awk.freeshell.org/Genius\\ Genius People - was looking for people that contributed . . . 1930-2002\\ "Go To Statement Considered Harmful"\\ http://en.wikipedia.org/wiki/Fred_Brooks . . .
6K - last updated 2014-07-07 06:17 UTC by y0tta
goto
== There is no goto statement or arbitary line labelling facility == The [[awk]] extraction and reporting . . . is line oriented and does not provide a goto statement or arbitary line labelling facility. === . . .
1K - last updated 2011-03-26 22:56 UTC by markhobley
Hello World in awk
This example program outputs the words "hello world" to the terminal: {{{ awk # Hello World BEGIN { print . . . that the [[function]] contains. === The print statement The first [[statement]] within the [[main]] . . . function calls the [[print]] statement with a [[string]] of [[character]]s, which . . .
2K - last updated 2010-11-11 19:16 UTC by markhobley
if
The if [[condition]]al construct allows a [[statement]] or [[block]] of code to be [[condition]]ally . . . its simplest form is: == if (CONDITION) STATEMENT == For example: {{{ if (guess == 6) print . . . execute a branch containing more than one statement == In order to [[conditional]]ly execute . . . more than one [[statement]] within a conditional [[branch]], it is . . . necessary to enclose the [[statement]]s within squiggly [[brace]]s: {{{ if (guess . . .
2K - last updated 2011-09-11 21:43 UTC by 92.40.253.171.threembb.co.uk
iterative loop
An '''iterative loop''' repeatedly executes a set of instructions as the [iterator] steps through a series . . . value. The [block] containing the [print] statement in the following example runs for each consecutive . . . contains three elements: * Initialization statement * Test condition * Continuation statement . . . ==== _Initialization statement_ The initialization statement executes before . . . the above example, l = 0 is the initialization statement. ==== _Test condition_ The test condition, . . .
2K - last updated 2011-08-13 21:00 UTC by markhobley
oawk
oawk is "old awk", it is the default /usr/bin/awk on Solaris and should not be used. You can also find . . . awk: syntax error near line 1 awk: illegal statement near line 1 }}} ==== no ARGC: {{{sh $ echo . . . awk: syntax error near line 1 awk: illegal statement near line 1 }}} ==== no -v: {{{sh $ echo . . . }' awk: syntax error near line 1 awk: illegal statement near line 1 }}} ==== No FNR variable: {{{sh . . . file2 awk: syntax error near line 1 awk: illegal statement near line 1 }}} ==== FS cannot be an RE: . . .
5K - last updated 2012-01-24 08:29 UTC by pgas
repeat
A '''repeat loop''' is a [conditional loop] that repeatedly executes a block of instructions whilst the . . . condition is true. The do statement is used together with an [while] syntactical . . .
1K - last updated 2011-08-14 16:00 UTC by markhobley
semicolon
== Separation of statements == The [[semicolon]] symbol can be used to separate multiple [[statement]]s . . . the same line. === A semicolon after the final statement is optional and can be omitted === A semicolon . . . after the final statement is optional and can be omitted. == Separation . . .
1K - last updated 2010-11-28 19:46 UTC by markhobley
SpecialFile
You can use `-v rulesfile=filename' to process a file differently, like you would any other variable, . . . use a `getline' loop (and `close') in your BEGIN statement. {{{ awk BEGIN \ { if (rulesfile=="") { print . . .
1K - last updated 2008-11-18 13:37 UTC by pgas
SpecialFileJapanese
You can use `-v rulesfile=filename' to process a file differently, like you would any other variable, . . . use a `getline' loop (and `close') in your BEGIN statement. {{{ awk BEGIN \ { if (rulesfile=="") { print . . .
1K - last updated 2008-11-24 08:09 UTC by pgas
statement
The [[awk]] extraction and reporting language is not [[imperative]]. However, [[action]]s within the . . . awk [[rule]]s may contain *statements* which can be executed sequentially to provide . . . computer to follow. == Each line is a separate statement in awk == In [[awk]], a newline character . . . is considered the end of the statement, unless a continuation character has been . . . Each line within an awk program is a separate statement or separate rule, and the end of the line . . .
2K - last updated 2011-05-21 16:43 UTC by markhobley
symbol
| *Symbol* | *Name* | *Purpose* | !! | [[pling]] | logical NOT | " | [[doublequote]] | | # | [[hash]] . . . | : | [[colon]] | | ; | [[semicolon]] | statement separator, rule separator | < | [[lessthan]] . . .
2K - last updated 2013-02-19 14:26 UTC by markhobley
variable
A '''variable''' is a symbolic name associated with a [[value]]. A variable acts as a container and the . . . = "hello " name; print newstr; }}} If the print statement is given several arguments (that is, they . . .
3K - last updated 2012-04-22 11:42 UTC by unregistered
20 pages found.