Sujet : Re: A feature I'd like to see in GAWK...
De : jbrubake.362 (at) *nospam* orionarts.invalid (Jeremy Brubaker)
Groupes : comp.lang.awkDate : 19. Jul 2024, 15:26:35
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v7dt2r$3147j$1@dont-email.me>
References : 1
User-Agent : slrn/1.0.3 (Linux)
On 2024-07-15, Kenny McCormack wrote:
As we know, AWK in general, and GAWK in particular, has several different
ways of getting data into the program. In addition to the Automatic Input
Loop (the main feature of AWK), there are several variations of "getline".
>
"getline" can be used with files, or with processes (in 2 different ways!),
or even with network sockets. But the problem with getline is that using
it breaks the Automatic Input Loop. You can't use the standard
"pattern/action" paradigm if your input is coming in via "getline". Yes,
there are workarounds and yes we've all gotten used to it, but it is a
shame. For one thing, you can write your program as a shell script, and
use the shell to pipe in the data from a process. But this is ugly. And
not always sufficient.
>
Now, I have written a GAWK extension to handle this - called
"pipeline".
That sounds quite useful. I am fairly certain I have wished a feature
like that existed and ended up just wrapping awk with sh but I agree
that's ugly.
Awk is underrated IMHO. Not that json/yaml/etc aren't useful things but
frequently when I seem them used my first thought is "If you had just
done well-formatted text records I could have parsed this with awk".
-- ()
www.asciiribbon.org | Jeremy Brubaker /\ - against html mail |
јЬruЬаkе@оrіоnаrtѕ.іо / neonrex on IRC
Even a hawk is an eagle among crows.