Demo entry 6365006

More of most of awk

   

Submitted by anonymous on May 17, 2017 at 16:06
Language: Awk. Code size: 686 Bytes.

#!/bin/awk -f

function foo(a, b, c) {
    return a + b - c
}

# A comment

BEGIN {
    srand(2)
    r = rand()
    ar[0] = "zero"; ar["one"] = 1
    if($1 == "one") length($1) else foo($2, $3, $4)
    while( r < 0.5 ) {
      sprintf "value %f less than 0.5"
      r = rand()
    }
    for( i=0 ; i<n ; i+=2 ) print i > output
    for( i in ar ) {
        print tolower(i)
        delete ar[i]
        continue
        print toupper(i)
    }
    delete ar
    do break while( 1 )
}

/^\t.([A-Za-z]|[0-9])+[[:alnum:]]*zero_or_this?$/ { next }
$2 ~ /two/ { nextfile }
$3 % 11 == 4 { exit int(cos($3)) }
/start/, /end/

END {
    print "that's all!"
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).