Node:Getline/Variable/Pipe, Next:Getline/Coprocess, Previous:Getline/Pipe, Up:Getline
getline into a Variable from a PipeWhen 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.