Sha256: f9cf844408772bc939eeccf2fb89dbda1d3ef20018a8c7d06c32af629ded8a99

Contents?: true

Size: 791 Bytes

Versions: 10

Compression:

Stored size: 791 Bytes

Contents

BEGIN{print "Hello world!"}


"BEGIN" is a "special pattern" - code within "{}" is executed before the input file is read, even if there is no input. "END" is a similar pattern, for after completion of main processing.

END {
     print "Hello world!"
    }


For a file containing data, the work can be done in the "body". The "//" is "match anything" so gets the first data, the "exit" halts processing the file (any "END" would then be executed).  Or instead of //, simply 1 is true.

//  { 
    print "Hello world!" 
    exit
    }



For a "single record" file.

//  { 
    print "Hello world!" 
    }


For a "single record" file containing - Hello world! -. The "default" action for a "pattern match" (the "/" and "/" define a "pattern" to match data) is to "print" the record.

// 

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/hello_world.text/awk.txt
zettacode-0.1.6 files.zettacode/hello_world.text/awk.txt
zettacode-0.1.6 files.zettacode2/hello_world.text/awk.txt
zettacode-0.1.5 files.zettacode/hello_world.text/awk.txt
zettacode-0.1.5 files.zettacode2/hello_world.text/awk.txt
zettacode-0.1.4 files.zettacode/hello_world.text/awk.txt
zettacode-0.1.4 files.zettacode2/hello_world.text/awk.txt
zettacode-0.1.3 files.zettacode/hello_world.text/awk.txt
zettacode-0.1.2 files.zettacode/hello_world.text/awk.txt
zettacode-0.1.1 zettacode.files/hello_world.text/awk.txt