(gawk.info.gz) Getline/Variable/Pipe

Info Catalog (gawk.info.gz) Getline/Pipe (gawk.info.gz) Getline (gawk.info.gz) Getline/Coprocess
 
 4.9.6 Using `getline' into a Variable from a Pipe
 -------------------------------------------------
 
 When you use `COMMAND | getline VAR', the output of COMMAND is sent
 through a pipe to `getline' and into the variable VAR.  For example, the
 following program reads the current date and time into the variable
 `current_time', using the `date' utility, and then prints it:
 
      BEGIN {
           "date" | getline current_time
           close("date")
           print "Report printed on " current_time
      }
 
    In this version of `getline', none of the built-in variables are
 changed and the record is not split into fields.
 
    According to POSIX, `EXPRESSION | getline VAR' is ambiguous if
 EXPRESSION contains unparenthesized operators other than `$'; for
 example, `"echo " "date" | getline VAR' is ambiguous because the
 concatenation operator is not parenthesized. You should write it as
 `("echo " "date") | getline VAR' if you want your program to be
 portable to other `awk' implementations.
 
Info Catalog (gawk.info.gz) Getline/Pipe (gawk.info.gz) Getline (gawk.info.gz) Getline/Coprocess
automatically generated by info2html