help-gawk
[Top][All Lists]
Advanced

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

How to get an error in piped getline?


From: Peng Yu
Subject: How to get an error in piped getline?
Date: Fri, 25 Feb 2022 22:33:33 -0600

$ awk -e 'BEGIN { exit_code = "zcat noexist.gz" | getline; print
exit_code, "|" $0 "|"}'
gzip: noexist.gz: No such file or directory
0 ||

https://www.gnu.org/software/gawk/manual/html_node/Getline_002fPipe.html

It is not clear how the error in a pipe is supposed to be dealt with
in awk. Is there a way to get the error in the external program called
in the pipe? Thanks.

-- 
Regards,
Peng



reply via email to

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