O'Reilly logo

Learning AWK Programming by Shiwang Kalkhanda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Starting the debugger

We have to pass the option --debug or -D, in addition to the -f option used to supply the AWK script on the command line. We cannot use GAWK debug for command line programs. It is essential to run awk commands from files with the -f option to launch the GAWK debugger as follows:

$ gawk  -D  -f  calc.awk 

Now, instead of immediately executing the program from calc.awk and returning the output on screen, this time GAWK loads the program source files, compiles them and gives us a prompt, as follows:

gawk>

From this prompt, we can issue commands to the debugger. At this point, no code has been executed.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required