awkc

compile AWK programs into executables 

Command


SYNOPSIS

awkc [-F ere] [-f prog] -o awkpgm [-O] [-P proto] [-v var=value ...] [program]


DESCRIPTION

awkc is a compiler/linker for awk programs. awkc links the compiled awk code to a prototype module which makes the program executable. You specify the name of the executable program. awkc should only be used after the given program has been successfully tested with awk.

Options

-F ere 

compiles to use the given extended regular expression ere to delimit input fields.

-f prog 

reads the awk program from the file prog.

-O 

optimizes the awk program's code by merging concatenated string literals (constants), and reducing constant integer expressions to their values.

-o awkpgm 

writes the awk program to the file awkpgm. This option is always required. On Windows systems, awkpgm must have the extension .exe.

-P proto 

replaces the prototype module with the specified prototype file, proto. The default prototype file is ROOTDIR/etc/awkrun. sys, where sys is usually nt.

-v var=value 

compiles the initial value of var to the given value.


EXAMPLES

The commands

awkc -o cmd.exe '{print NR ":" $0}'
cmd.exe input1

are equivalent to the single command:

awk '{print NR ":" $0}' input1

This example prints the contents of the file input1 with line numbers prepended to each line.

The following is an example using var=value on the command line.

awkc -o cmd.exe '{print NR SEP $0}'
cmd.exe SEP=":" input1

awkc can also read the program script from a file as in this command line:

awkc -o addline.exe -f addline.awk
addline input1

which produces the same output when the file addline.awk contains

{print NR ":" $0}

ENVIRONMENT VARIABLES

PATH 

contains a list of directories that is searched by the awkc generated program to find the current image of the program and to look for commands executed by system(expr), or input and output pipes.

Any other environment variable may be accessed by the awk program itself.


FILES

ROOTDIR/etc/awkrun.sys 

default prototype module for inclusion in created executables. awkc links the prototype module to the compiled script to create an executable program. The suffix sys is replaced as appropriate depending upon the operating system.

ROOTDIR/etc/awkrun.nt 

default prototype module for Windows systems.


DIAGNOSTICS

For information on diagnostic messages, see the awk reference page.

The executables created by awkc cannot be compressed and run. If an executable is altered, it gives one of the following diagnostic messages:

Bad CONSTANT literal flags=num 

Executable corrupted or internal error.

Bad literal type=num 

Executable corrupted or internal error.

Bad magic 

Executable compressed, truncated or corrupted.

Bad PoolSize 

Executable corrupted or internal error.

FUNC reserved error num 

Executable corrupted or internal error.

Literal num out of range! 

Executable corrupted or internal error.

premature eof 

Executable truncated.

string: not found 

Executable corrupted or internal error.

sync: hex1, hex2, num1 

Executable corrupted or internal error.


PORTABILITY

Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
awk


PTC MKS Toolkit 10.4 Documentation Build 39.