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

Exit usage

As the name suggests, the exit statement is used to immediately stop the execution of AWK script. On getting the exit statement at any place in AWK script, AWK stops executing current rule and current processing of input. Any remaining input if any is ignored. The syntax of the exit statement is as follows :

exit [ return status ]

It accepts an integer value as an argument to set the exit/return status of the AWK process. Supplying of a return status as an argument is optional. If no argument is given to the exit statement, it returns the exit status as zero.

If an exit statement is executed from the BEGIN statement, the program stops processing everything immediately and no input records are read. And if an END statement is present, ...

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