bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gawk] What is wrong with getline from both stdin and a file from AR


From: Peng Yu
Subject: [bug-gawk] What is wrong with getline from both stdin and a file from ARGV?
Date: Wed, 28 Nov 2018 11:13:00 -0600

Hi,

The second command gives an error. I don't understand why it should
cause an error, but the other two did not. Could anybody help explain
this? Thanks.

$ awk -e 'BEGIN { getline < ARGV[1] }' <(printf '%s\n' {a..c})
printf '%s\n' {a..c}
$ printf '%s\n' {1..3} | awk -e 'BEGIN { getline; getline < ARGV[1] }'
<(printf '%s\n' {a..c})
printf '%s\n' {a..c}
awk: (FILENAME=/dev/fd/63 FNR=1) warning: close of fd 63
(`/dev/fd/63') failed (Bad file descriptor)
$ printf '%s\n' {1..3} | awk -v f=<(printf '%s\n' {a..c}) -e 'BEGIN {
getline; getline < f; print }'
printf '%s\n' {a..c}
a

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]