March 2018
Beginner to intermediate
416 pages
9h 24m
English
This option enables the profiling of AWK programs, that is, it generates a pretty-printed version of the program in a file. By default, the profile is created in a file named awkprof.out. The optional file argument allows you to specify a different filename for the profile file. No space is allowed between -p and the filename, if a filename is supplied:
-p[file] --profile[=file]
The profile file created contains execution counts for each statement in the program in the left margin, and function call counts for each function. In the next example, we will create a file with a name sample and redirect the output of the AWK command to /dev/null:
$ awk --profile=sample \'BEGIN { print "**header**" }{ print } Read now
Unlock full access