AA-awk-history
http://awk.freeshell.org/AA-awk-history\\ a concise history of awk and some of its forks\\ {{{ common . . . adds functions: close system atan2 sin cos rand srand match . . . keywords: do delete function return\\ [3] current maintainer - the dr. . . .
2K - last updated 2013-10-26 02:28 UTC by g0ph3r
Adler32Checksum
As documented in the [[http://en.wikipedia.org/wiki/Adler-32 | Adler-32 Wikipedia article]]. {{{ awk . . . function adler32(str, a,b,len,i,j,MOD_ADLER,MAX_BLOCK) . . . should really be done outside of the # function definition here and shared across the global . . . ugly than recomputing it on every call # to this function. It would be trivial to add an 'ord' argument . . . # to the call list to allow calling functions to skip the init # process if they are smart, . . .
4K - last updated 2008-12-31 12:05 UTC by pgas
AllAboutGetline
//Editor's notes: The article was originally posted on the comp.lang.awk newsgroup, and can still be . . . of an input file or files, e.g.: {{{ sh awk 'function read(file) { while ( (getline < file) > . . .
16K - last updated 2009-02-15 22:14 UTC by waldner
ArrayLength
Posix does not define a way to get the length of an array, while you could use a loop to count the elements . . . length on an array passed as an argument to a function: {{{ awk #!/usr/bin/gawk -f function foo(array){ . . . the length as an extra argument printf "In a function, the length of array is %d\n", length(array) . . .
2K - last updated 2009-02-09 09:45 UTC by arnold.robbins
awk nawk oawk
in 1977 there was awk.\\ this page attempts to explain the history of awk.\\ the 1978 7th Edition awk(1) . . . System V Rel 3.1\\ page 80: new things added\\ functions: close system atan2 sin cos rand srand match . . . FNR RSTART RLENGTH SUBSEP\\ keywords: do delete function return\\ the latest One True awk:\\ http://www.cs.princeton.edu/~bwk/btl.mirror/index.html\\ . . . eg: {{{awk BEGIN { _print_SYMTAB(); exit(0); } function _print_SYMTAB( varname, fmt) { fmt = "SYMTAB['%s'] . . . > "/dev/stderr"; #: can not access array or function names return(1); } }}} . . .
2K - last updated 2012-03-18 23:21 UTC by g0pher
AwkDc
This is an awk implementation of the [http://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html|dc] . . . The dc backbone {{{ #!/usr/bin/awk -f # DEBUG FUNCTIONS {{{ ----- function showop(op) { #print "op: . . . " op >> "/dev/stderr" return } function putstring(stk, str) { _dc_put(stk, "[" str . . . "]") } # }}} ----- # PRIMORDIAL FUNCTIONS {{{ ----- function _dc_put(stk, num) { showop("put") . . . stk[++stk[SP]] = num } function _dc_pop(stk) { showop("pop") return stk[stk[SP]--] . . .
12K - last updated 2008-07-17 14:47 UTC by gnomon
AwkGuide
** Work in Progress ** {{{ import from Mark Hobley's wiki }}} <toc> ---- == Overview * [[Overview]] . . . * [[brace]]s * [[branch]]es * [[builtin function]]s * [[calling section]] * [[case conversion]] . . . * [[default variable]] * [[define functions]] * [[delimiter]]s * [[destructor]]s * [[division]] . . . * [[for loop]]s * [[foreach]] loops * [[FS]] * [[function]]s * [[gawkism]]s * [[getline]] * [[goto]] . . . * [[loop]]s * [[main]] * [[mathematical function]]s * [[mistake]]s * [[modulus]] operator * . . .
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 . . . this seemingly valid program: {{{ awk -F '[.]' 'function ok(n){return (n>=0 && n<=255)} . . . against a regular expression: {{{ awk -F '[.]' 'function ok(n) { return (n ~ /^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/) . . . This can be done with the following function: {{{ function ok(n) { return (n !~ /[^0-9]/ . . . to ferret from #bash for the suggestion): {{{ function ok(n) { return (int(n)==n"" && n>=0 . . .
31K - last updated 2009-03-24 16:54 UTC by waldner
AwkVsPerl
A valid question, since awk is a subset of perl (functionally, not necessarily syntactically); also, . . .
2K - last updated 2011-01-22 05:33 UTC by steve
AwkVsPerlJapanese
A valid question, since awk is a subset of perl (functionally, not necessarily syntactically); also, . . .
2K - last updated 2008-11-24 08:05 UTC by pgas
bitwise operator
Traditional [[awk]] implementations do not support bitwise operators. == Function Gawkisms == Bitwise . . .
1K - last updated 2011-03-07 19:55 UTC by markhobley
calling section
A '''calling section''' is a section or [[block]] of code that makes a call to a subroutine or [[function]]. . . . that makes the call to the [[subroutine]] or [[function]]. This will usually be a call instruction . . . or function name. === Return point === The return point . . . to be executed after the [[subroutine]] or [[function]] has returned. == Evaluation of return values . . . [[return code]] given by the [[subroutine]] or [[function]] that was called. . . .
1K - last updated 2011-05-06 21:57 UTC by markhobley
case conversion
The [[awk]] extraction and reporting language provides the toupper and tolower functions for converting . . . tolower(STRING) === Description === The tolower function returns a lowercase version of the STRING . . . argument. This function converts all letters to lowercase in the returned . . . toupper(STRING) === Description === The toupper function returns a lowercase version of the STRING . . . argument. This function converts all letters to uppercase in the returned . . .
2K - last updated 2011-06-25 05:10 UTC by pgas
case sensitivity
== Indentifier names == The [[awk]] interpreter is lettercase sensitive. This means that [[variable name]]s . . . and reporting language provides a variety of functions for converting [[string]]s to uppercase or . . .
1K - last updated 2011-06-25 05:14 UTC by pgas
CaseInsensitive
{{{}}}**Use tolower()** * portable * must be explicitly used for each comparison Instead of: {{{ awk . . . for all comparisons, regex comparisons, index() function * not used for array indexing . . .
1K - last updated 2008-11-26 12:39 UTC by pgas
CAWKLib
=CAWKLib CAWKlib is a library of functions for for awk intended to be used with preprocessors/wrappers . . . The focus has been mostly on implementing functionality that exists in other dynamic languages . . . Kit # I needed a pre-processor to handle the functions I was building and none of the existing ones . . . I just called the thing CAWKLib ==What sort of functionality is implemented in CAWKLib? There is much . . . more work to be done but here are some of the functions in CAWKlib as it is today arrays.awk: *ary_length() . . .
5K - last updated 2015-01-29 10:14 UTC by 108-243-116-77.lightspeed.cicril.sbcglobal.net
ConvertHexToFloatingPoint
This code uses [[gawkism|gawk specific features]], such as the [[http://www.gnu.org/manual/gawk/html_node/Strtonum-Function.html][strtonum]] . . . function, so [[gawk]] is required to utilize this function. . . . by Orley and Matthews]]. = AWK Code {{{ # function to convert 4 "bytes" of hex chars into a floating . . . was used to test my code # function HexToFP(b3,b2,b1,b0) { fval = 0 bias=127 # . . . ===== ######################################## # function to convert from raw to ieee 754 float32 # . . .
3K - last updated 2010-06-23 19:49 UTC by john b
division
== Quotient Division == The [[slash]] symbol can be used as the division [[operator]] to produce the . . . integer division operator. However, the [[int]] function can be used to produce [[integer]] results . . .
2K - last updated 2011-03-20 07:07 UTC by markhobley
EmptyArray
You can test if an array is empty using this function: {{{ awk function empty(a, i) { for(i in a) return . . . 0; return 1} }}} This function comes from comp.lang.awk see this [[http://groups.google.com/group/comp.lang.awk/browse_thread/thread/6ed0f7a40952f092/c3b65ed3c7832f13?lnk=gst&q=empty+robbins#c3b65ed3c7832f13|post]] . . .
1K - last updated 2009-03-12 08:11 UTC by pgas
FileExistence
The most portable way to test for the existence of a file is to simply try and read from the file. {{{ . . . awk function exists(file, dummy, ret) { ret=0; if ( (getline . . .
1K - last updated 2008-11-18 13:26 UTC by pgas
FileExistenceJapanese
The most portable way to test for the existence of a file is to simply try and read from the file. {{{ . . . awk function exists(file, dummy, ret) { ret=0; if ( (getline . . .
1K - last updated 2008-11-24 08:07 UTC by pgas
FindAllIndices
Sometimes it is useful to find the index of every occurrence of a given character in a string. Let's . . . and each even index, the end of one. {{{ awk function findallindices(str, chr, arr, i, j) { for . . . i, 1) == chr) arr[++j] = i return j } }}} The function returns the number of instances found as a . . .
2K - last updated 2011-07-05 10:53 UTC by pgas
FindAllMatches
This bit of code will match all non-overlapping instances of a given pattern in a string and will store . . . of patterns found. This duplicates some of the functionality provided by the gawk extension to match() . . . text in the provided array. You can use the function as is, and just get the list of matches in . . . argument list to add the start[] array {{{ awk function FindAllMatches(str, re, arr, j, a, b) { j=0 . . .
2K - last updated 2009-03-24 09:46 UTC by waldner
FIXES
[[FIXES]] revised: . . . %* format, -Ft ---- added toupper and tolower functions (Oct xx, 1987)\\ recognize -- as terminator . . . options\\ evaluate all arguments of built-in functions, as in C; the appearance . . . are evaluated before the function is called\\ Added \a ("alert"), \v (vertical . . . classes (Sep 24, 2000)\\ close() is now a function. it returns whatever the . . .
6K - last updated 2014-01-15 23:17 UTC by g0ph3r
gawkism
Gawkisms are non portable syntax components that do not work with some awk implementations. The use of . . . * !/dev/pgrpid * !/dev/user * [[asort]] function * [[ARGIND]] * [[and]] (bitwise function) . . . * [[AWKPATH]] * [[bindtextdomain]] function * [[BINMODE]] * [[bitwise]] functions * [[dcgettext]] . . . function * delete array * [[ERRNO]] * [[exponent]] . . . operator * [[FIELDWIDTHS]] * [[gensub]] function * [[hexadecimal]] notation * [[IGNORECASE]] . . .
2K - last updated 2011-05-19 22:29 UTC by markhobley
GeneralizedTextReplacement
Some times people need to recode in awk something they were previously doing with sed or another tool. . . . replaced by the corresponding strings in rep[] function BuildNew(n,orgstr,mtch,start,rep, newstr,last,j,psep) . . . possible to put all the above code in a single function and use that one to emulate sed (using a single . . . what you want. Furthermore, the FindAllMatches function can also be used as is for different purposes. . . .
6K - last updated 2009-03-26 20:38 UTC by waldner
GeoLocation
{{{ awk #!/bin/gawk -f function getcoord(string, a) { split(string, a, ":") gsub(/\"/, "", a[2]) return . . . a[2] } function httpget() { host = "geoiplookup.wikimedia.org" . . .
1K - last updated 2011-11-14 16:35 UTC by pgas
getline
The *getline* command can obtain input from any number of files and does not require a command line parameter . . . _There is no corresponding putline_ The getline function does not have a corresponding '''putline''' . . . function. In [[awk]], output to a specific file is . . .
1K - last updated 2011-05-02 20:14 UTC by markhobley
Glossary
[[Glossary| Glossary]]\\ see also [[AwkOnWindows| AwkOnWindows]] and [[FIXES| FIXES]] and [[AwkOnWindowsHowto| . . . language' A7.3.2 p.202 'the arguments and the function designator are completely evaluated , including . . . all side effects, before the function is entered.' B1.3 p.245 'White space characters . . .
2K - last updated 2010-10-24 08:14 UTC by g0pher
Hello World in awk
This example program outputs the words "hello world" to the terminal: {{{ awk # Hello World BEGIN { print . . . === Squiggly Brackets The contents of the begin function is enclosed in [[brace]]s. This defines the . . . boundaries of the [[block]] of code that the [[function]] contains. === The print statement The first . . . [[statement]] within the [[main]] function calls the [[print]] statement with a [[string]] . . .
2K - last updated 2010-11-11 19:16 UTC by markhobley
HomePage
This wiki is maintained by regulars from the **#awk** channel on **[[https://libera.chat/|irc.libera.chat]]** . . . === gawk specific code snippets The following functions utilize [[gawkism|gawk specific features]], . . .
5K - last updated 2023-06-26 04:15 UTC by HappMacDonald
include
The [[awk]] extraction and reporting language does not support the use of include files. However, it . . . switches: {{{ awk -f one.awk -f two.awk }}} === _Functions in different source files will be visible_ . . . The functions defined in different source files will be . . . {{{ # one.awk BEGIN { sayhello() } # two.awk function sayhello() { print "Hello world" } }}} === . . . _Function names must be unique across all used sources_ . . .
2K - last updated 2013-03-30 10:38 UTC by markhobley
index
== Usage == === index [ STRING, SUBSTRING ] === The index [[function]] is used to locate the first occurrence . . .
1K - last updated 2011-06-09 20:36 UTC by markhobley
LastMatchOnLine
The function 'match' sets RSTART to the index of each match and RLENGTH to its length, and returns 0 . . . finds matches, and take the final match. {{{ awk function lastmatch(re, line, result) { while(match(line, . . .
1K - last updated 2009-04-14 22:07 UTC by 216.162.199.202
length
== Usage == === length ([ STRING ]) === The **length** function returns the number of characters within . . .
1K - last updated 2011-06-25 05:11 UTC by pgas
LevenshteinEditDistance
The [http://en.wikipedia.org/wiki/Levenshtein_distance|Levenshtein edit distance] calculation is useful . . . awk # commentary elided for now pending feedback function levdist(str1, str2, l1, l2, tog, arr, i, j, . . . } }}} ==== Unit tests {{{ awk #!/usr/bin/awk -f function testlevdist(str1, str2, correctval, testval) . . .
6K - last updated 2010-04-16 10:19 UTC by pgas
libmawk
libmawk is a fork of [[mawk]], designed for embedding in C programs. Compare and contrast with [[awka]]. . . . * all these without threads or fork() * call awk functions from C, using vararg for smooth integration . . . * call C functions from awk scripts * resolve existing awk variables . . . in the lib and executable version) ** dynamic function calls (call functions by name using call() . . .
2K - last updated 2012-01-16 09:07 UTC by lewellyn
limitation
== Limitations of awk Some traditional versions of [[awk]] derived from [[Unix]] version 7, may not conform . . . allowed before the opening parenthesis in a user function call Do not leave white space before the opening . . . parenthesis in a user function call. This is not allowed by [[posix]], and . . .
1K - last updated 2009-04-20 15:50 UTC by Mark Hobley
LshalOutputParser
=== Problem Specification 10:50 <Thanatermesis> i want to obtain the model of the disk, for example, . . . {{{ BEGIN { skip = 1 inBlock = 0 FS = " = " } function die(msg) { printf "ERROR on line %d of input: . . . %s\n", NR, msg >> "/dev/stderr" exit 1 } function trim(str) { sub(/^ +/, "", str) sub(/ +$/, . . . "", str) return str } function startBlock() { split("", PROPERTIES) # delete . . . the type annotations as well parseBlockLine() } function parseBlockLine( key, val, type) { key = trim($1) . . .
3K - last updated 2008-06-27 16:22 UTC by gnomon
main
== Making the application start up from a main routine == In some languages, a '''main''' function provides . . . is [[datadriven]], so does not have a main function. However, it does support the use of [[begin]] . . .
1K - last updated 2011-07-18 09:57 UTC by markhobley
mathematical function
The awk programming language provides a set of [[builtin]] functions for performing various mathematical . . .
1K - last updated 2011-02-19 18:58 UTC by markhobley
numeric strings
Numeric strings obtained from the input source, will be treated as numeric values, when compared with . . . print "Test 13: '100' and '21'" compare(a,b) } function compare(a,b) { if (a == b) { print "Comparison . . .
5K - last updated 2013-02-24 17:40 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 . . . =",$0), "<bar>"}' foo = }}} ==== no functions: {{{sh $ echo "foo" | /usr/xpg4/bin/awk 'function . . . {bar()}' foo $ echo "foo" | /usr/bin/awk 'function bar(){print} {bar()}' awk: syntax error near . . . 'NR==FNR{print}' file1 file2 }}} ==== No match() function: {{{sh $ /usr/xpg4/bin/awk '{print match($0,"a")}' . . .
5K - last updated 2012-01-24 08:29 UTC by pgas
OpeningFiles
You can open files dynamically using `getline', `close', and `print EXPR > FILENAME', like: {{{ awk . . . file has at least 1 line, output file writeable function double(infilename,outfilename, aline) { while . . .
1K - last updated 2008-11-18 13:33 UTC by pgas
OpeningFilesJapanese
You can open files dynamically using `getline', `close', and `print EXPR > FILENAME', like: {{{ awk . . . file has at least 1 line, output file writeable function double(infilename,outfilename, aline) { while . . .
1K - last updated 2008-11-24 08:09 UTC by pgas
operator
The [[awk]] programming language provides a series of *operators* that allow [[value]]s and [[variable]]s . . . traditional awk implementations, but equivalent functions are available as [[gawkism]]s * [[concatenation]] . . .
3K - last updated 2011-05-24 22:19 UTC by markhobley
Overview
= Overview of awk = == The primarily purpose of awk is to processing textual data to produce formatted . . . components: * [[comment]]s * [[rule]]s * [[function]] definitions * [[hashbang]] == The awk utility . . .
4K - last updated 2011-05-23 23:09 UTC by markhobley
parentheses
== Grouping components of boolean expressions == Components of boolean expressions can be grouped together . . . using parentheses: == Passing arguments to functions == Arguments passed to functions should be . . .
1K - last updated 2010-11-09 00:48 UTC by markhobley
precedence
The [[awk]] programming language uses rules of *precedence* to determine the order in which [[operator]]s . . . multiplication }}} == _Groups of operators or functions within parentheses have the same precedence . . . as normal_ Groups of [[operator]]s or [[function]]s within parentheses have the same precedence . . .
7K - last updated 2013-04-11 06:58 UTC by markhobley
PrimeNumberSieve
This is the standard sieve of Eratosthenes implemented in portable awk. The running time of the bare . . . benefits? === The Code {{{ #!/usr/bin/awk -f function sift1(N, primes, line, sp, n, i, j) { line . . . = i * i; j < N; j += i) $j = "1" $0 = line } function sift2(N, primes, n, sp, nums, i, j) { n = . . . and therefore must all pass through the hash function (numeric keys must suffer the extra indignity . . .
4K - last updated 2008-06-19 05:56 UTC by gnomon
print
== Usage == === print [ LIST ] === The [[variadic]] **print** function is used to produce simple standardized . . . print "Hello" == Default value == If the print function is given no [[argument]] list, then it will . . .
1K - last updated 2011-05-11 15:10 UTC by markhobley
printf
== Usage == === printf [ FORMAT, LIST ] === The **printf** [[variadic]] function provides generic [[string . . . output]] in a similar manner to the printf function used in the C programming language. The printf . . . function uses the same string formatting functions . . . [[newline]] character to its output. The printf function provides support for the complete set of ANSI . . .
2K - last updated 2011-06-09 20:34 UTC by markhobley
PureEvil
Not related to awk, just for fun. Some deliberately obfuscated and evil commands: {{{ sh # squeeze the . . . {newlines,RS}={12,} #not useful at all...in bash function for { echo $1 ;};for for in for;do \for $for;done . . .
1K - last updated 2011-09-08 14:00 UTC by pgas
qse
Not a standalone awk, but an interesting library embedding an awk interpreter, from [[https://groups.google.com/group/comp.lang.awk/browse_thread/thread/b02c0d75e49eab75/54fc2c6316d657bc?lnk=gst&q=c%2B%2B+embed#54fc2c6316d657bc| . . . is capable of: * adding new global variables and functions. * getting and set the value of a global . . . variable. * calling a function with or without parameters and getting its . . . * execute pattern-action blocks or call a function * close the runtime context * close the interpter . . .
4K - last updated 2011-10-27 06:25 UTC by pgas
RangeOfFields
Printing a range of fields - all fields but the first, for examples, or fields 3 through 8 - is a surprisingly . . . {{{fld[0]}}} and {{{fld[nf]}}} don't exist. ==== Function using match() and substr() This approach uses . . . separators intact. returns the extracted fields. function extract_range(str, start, stop, i, re, out) . . .
10K - last updated 2015-09-08 09:52 UTC by pgas
Recursively Include C headers
=== Problem Specification i want to generate one big .hpp file out of multiple .hpp files and want to . . . ip, /:/) } { print_line($0) } function print_file(file, line) { while (getline line . . . < file > 0) print_line(line) close(file) } function print_line(line, f, file) { if (match(line, . . . = 1 print_file(file) } } else print line } function complete_path(file, p) { if (file ~ /^[\/.]/) . . .
1K - last updated 2011-12-11 05:33 UTC by pgas
redirection
The awk scripting language provides support for redirection via the greaterthan, doublebeak and pipe . . . redirection operator allowing output from a function to be written to a named file. If the named . . . will be overwritten by the output from the function: {{{ awk BEGIN { # Creates a file foobar.txt . . . the file being overwritten, the output from the function will be appended to the end of the file: {{{ . . .
2K - last updated 2011-06-25 05:12 UTC by pgas
RepeatAString
Sometimes it is useful to have something like Perl's 'x' operator, which repeats a string N times. This . . . lines when building a table of contents. {{{ awk function rep(str, num, remain, result) { if (num < . . . result result (remain ? str :"") } }}} The function {{{rep}}} above is recursive, but performs . . .
1K - last updated 2009-03-01 19:15 UTC by h-67-101-152-180.nycmny83.dynamic.covad.net
return
The [[builtin]] '''return''' [[command]], can be used to exit from a [[function]] within the [[awk]] . . . to set an errorlevel === By convention, when a function exits normally it should give a [[return value]] . . . of zero: return 0 # Function completed normal operation without an error . . . by the [[calling section]]: return 245 # Function gave an internal error === Omitting the return . . . evaluation based on the [[return value]] of a [[function]] that returns an [[unspecified]] value. === . . .
2K - last updated 2011-05-03 17:29 UTC by markhobley
reverse
The [[awk]] extraction and reporting language does not provide a [[builtin]] function for reversing strings. . . . to achieve this by creating a user defined [[function]]. The following example demonstrates the . . . definition of a reverse function and its invocation: {{{ awk function reverse(s) . . . revs = revs c } return revs } # Call the reverse function to reverse our string BEGIN { print reverse("anut . . .
1K - last updated 2011-06-25 05:11 UTC by pgas
ReverseMapping
{{{ awk # reverse mapping of keys -> values in given array function reverse_mapping(array, tmp_key, . . .
2K - last updated 2014-04-23 00:33 UTC by emg
RS
= Record Separator = The [[special variable]] RS is a record separator that is used to determine how . . . behaviour, but it is possible to use the split function to extract fields as desired. == Setting the . . .
3K - last updated 2013-02-19 23:11 UTC by markhobley
Shellquote
This function ensures that strings you use as arguments to the **system()** function (or **"cmd"{{{|}}}getline** . . . argument is wrapped in single quotes. {{{ awk function shellquote(str) { gsub(/'/, "'\\''", str) . . .
1K - last updated 2009-03-01 00:35 UTC by h-67-101-152-180.nycmny83.dynamic.covad.net
SimpleCalc
Simple 4 operations calculator ... {{{ awk # usage: print calc("5 * (1 + 2) * 5 + 7") # reads and update . . . s[0] # return the first token function next_token(s, t) { sub(/^[[:space:]]*/,"", . . . # return the length of the postfixed array function s_y( input, postfixed ,len, stack, head, op, . . . } return len } #eval the postfixed operation function eval(postfixed, len, stack, ptr, i) { for . . . = postfixed[i] } } return stack[ptr] } function calc(input, postfixed, len) { len = s_y(input, . . .
2K - last updated 2015-09-10 06:14 UTC by pgas
SizeOfSplit
How many elements were created by split()? When I do a split on a field, e.g., {{{ awk split($1,x,"string") . . . or doing a `for (n in x)' test)? split() is a function; use its return value: {{{ awk n = split($1, . . .
1K - last updated 2008-11-18 12:35 UTC by pgas
SolarisNawk
I want to use the tolower() function with {{{SunOS}}} nawk, but all I get is {{{ nawk: calling undefined . . . function tolower }}} The {{{SunOS}}} nawk is from a . . . before awk acquired the tolower() and toupper() functions. Either use one of the freely available awks, . . . (if you have it), or write your own function to do it using index, substr, and gsub. An . . . example of such a function is in O'Reilly's _Sed & Awk_. {{{Patrick . . .
1K - last updated 2008-11-24 08:24 UTC by pgas
SolarisNawkJapanese
I want to use the tolower() function with {{{SunOS}}} nawk, but all I get is {{{ nawk: calling undefined . . . function tolower }}} The {{{SunOS}}} nawk is from a . . . before awk acquired the tolower() and toupper() functions. Either use one of the freely available awks, . . . (if you have it), or write your own function to do it using index, substr, and gsub. An . . . example of such a function is in O'Reilly's _Sed & Awk_. {{{Patrick . . .
1K - last updated 2008-11-24 08:36 UTC by pgas
string manipulation function
The [[awk]] programming language provides a set of [[builtin]] functions for performing various string . . .
1K - last updated 2011-06-07 00:35 UTC by markhobley
substr
=== Removing the first and last characters from a string === The following [[script]] demonstrates how . . . the [[substr]] function and [[length]] functions can be combined to . . .
1K - last updated 2011-06-25 05:10 UTC by pgas
text.2.wiki.awk
#: C:\#\awk\lib\text.2.wiki.awk\\ . . . if(_clip) _put2clip(t);\\ }\\ \\ function . . . return(close(c));\\ }\\ \\ function . . .
11K - last updated 2012-09-24 14:55 UTC by g0ph3r
tracert.awk
{{{ awk #:: C:\_\_u\tracert.awk #: 2014-07-06 19:47:02 #:: rod.t_2014 #:: extract basename for tracert . . . disables run) #:: to test: -v _test=1 #:: functions: _dequote, _testf, _env, _dt ## _____ BEGIN . . . _con; getline < _con; exit(0 + _exitcode); } function _dequote(s, n) { #:: \042 " \043 # \047 ' . . . true if(_debug < 2) break; } return(s); } function _testf( cmd, s, t) { ##: htpp://.www.newegg.com./pr/pr.aspx?item=n82e . . . =\n" s); exit(_exitcode = sysmul * system(s)); } function _env(s, i) { s = tolower(s); for(i in ENVIRON) . . .
4K - last updated 2014-07-07 06:15 UTC by 212.205.56.222
WartAndWishList
Awk is a wonderful language! That said, there are a few annoying bits... == The Good * well-documented . . . to the {{{match(string, pattern)}}} built-in function is jarring. The gawk manual mentions that . . . but it is backward from every other built-in function that operates on strings. * There is no way . . . to return an array from a function. It is possible to pass an array into a function . . . but it makes it difficult to write out longer functions that declare and explain their arrays at . . .
7K - last updated 2009-04-13 18:39 UTC by goedel
What is awk
awk is an extraction and reporting language, named after its three original authors: * Alfred V. **A**ho . . . converters which allow you to achieve the same functionality (by compiling the resulting C code later). . . .
5K - last updated 2014-11-28 08:24 UTC by pgas
What is awkJapanese
awk is a programming language, named after its three original authors: * Alfred V. Aho * Brian W. Kernighan . . . converters which allow you to achieve the same functionality (by compiling the resulting C code later). . . .
2K - last updated 2008-11-24 08:03 UTC by pgas
74 pages found.