compile AWK programs into executables 



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


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.


-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.


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.


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}



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.



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.


default prototype module for Windows systems.


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.


Windows XP. Windows Server 2003. Windows Vista. Windows 7. Windows Server 2008. Windows 8. Windows Server 2012.


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



PTC MKS Toolkit 9.6 patch 1 Documentation Build 5.