|
|
The built-in function system(command-line)
executes the command command-line, which can be a string
computed by, for example, the built-in function
sprintf. The value returned by system is the
return status of the command executed. The output from
command-line is not automatically available for use within
the awk script. It must be piped into getline,
as follows:
system(command-line | getline)
The following program calls the shell command cat(C) to print the file named in the second field of every input record whose first field is ``#include,'' having first stripped any <, >, or " characters that might be present:
$1 == "#include" { gsub(/[<>"]/, "", $2); system("cat " $2) }