bug-gawk
[Top][All Lists]
Advanced

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

Re: (No subject)


From: Wolfgang Laun
Subject: Re: (No subject)
Date: Sat, 4 Apr 2020 15:04:19 +0200

On Sat, 4 Apr 2020 at 14:24, john doe <address@hidden> wrote:

>
> 04.04.2020, 15:15, "Wolfgang Laun" <address@hidden>:
>
> > Why do you think you need to use getline?
>
> I certainly don't -- if there's a better way. It's just this particular
> script needs to be self-contained (no pipes, no arguments, no complex
> command line, just one file to launch).
>
You don't say that the "one file" has to be a gawk program.  What has been
done frequently is to write a shell script that calls the producer, any
program that produces output on standard input and pipes this to the
consumer, here it is an awk process. The awk program reads from standard
input, using the simple input loop (no getline, no system), with the great
benefit of having all the addressing techniques for selecting input
records. Both getline and reading from a subprocess are "last resorts",
e.g., when you need to process two or more input streams.

Running a pipeline that has one or more participants that need a script
from a single file is best done by using a shell script. There is no better
"glue" than one of the (standard) shell.
-W




> (And, well, getline does work, and it's just a bit slower than a pipe. So,
> at first I was puzzled why, but since you were so kind to explain, it's now
> only some sort of perfectionism, and nothing else.)
>
>
> Thank you for your interest,
>
> --
> JD
>
>


reply via email to

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