bug-gawk
[Top][All Lists]
Advanced

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

Re: Proposal: document that getline is a function, not command/statement


From: david kerns
Subject: Re: Proposal: document that getline is a function, not command/statement
Date: Wed, 10 Jul 2024 05:52:58 -0700

Denys Vlasenko <dvlasenk@redhat.com> wrote:
On Wed, Jul 10, 2024 at 12:19 AM <arnold@skeeve.com> wrote:

> > Maybe add an example, I like the "while (getline <"FILE" > 0) ..."
> > thing from stackoverflow.
>

perhaps gawk is different, apologies for not taking the time to test, but
in the One True awk, you have to use an extra set of parenthesis:

while ((getline < "FILE") > 0)

I've also found limitations on reading into $0, i.e. in a BEGIN, again from
OTA, so I always read into a variable:

while ((getline x < "FILE") > 0)

writing "portable" awk code has never hurt me


reply via email to

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