#6 Nonstandard Getline behavior

v1.0 (example)
open
nobody
None
5
2013-08-16
2013-02-16
yanlend
No

getline function changes variables that it should not according to http://www.gnu.org/software/gawk/manual/html_node/Getline-Summary.html#Getline-Summary
I used the function in the form
command | getline var
but at least FILENAME and NF were changed. For my application of the type
/pattern/ {
cmd = "wget -t 1 -nv " $1 " 2>&1"
while ( (cmd | getline line) > 0 )
result = result " " line
close(cmd)
}
it had the consequence of stopping the awk script after processing one line of the input file instead of processing each line. The script works correctly with Gawk.

Discussion

  • Peter
    Peter
    2013-08-16

    I have a fix resolving the issue. How can I contribute to the source?