DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Programming with awk

The system function

The built-in function system(command-line) executes the command command-line, which may 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.

For example, the program

   $1 == "#include"  { gsub(/[<>"]/, "", $2);
     system("cat " $2) }
calls the command cat to print the file named in the second field of every input record whose first field is #include, after stripping any <, >, or " that might be present.
Next topic: Cooperation with the shell
Previous topic: Using awk with other commands and the shell

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004