Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The autodecrement is not magical. -- Larry Wall in the perl man page


devel / comp.lang.awk / Re: /dev/stdin on an Event Stream

SubjectAuthor
* /dev/stdin on an Event StreamStephen
+- Re: /dev/stdin on an Event StreamJanis Papanagnou
`- Re: /dev/stdin on an Event StreamEd Morton

1
/dev/stdin on an Event Stream

<6294a38a-d7cb-4ec4-8b47-025915bde02cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=798&group=comp.lang.awk#798

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:ac8:4654:: with SMTP id f20mr7212220qto.144.1623476037915;
Fri, 11 Jun 2021 22:33:57 -0700 (PDT)
X-Received: by 2002:a25:9981:: with SMTP id p1mr11479140ybo.246.1623476037314;
Fri, 11 Jun 2021 22:33:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Fri, 11 Jun 2021 22:33:57 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=108.48.23.111; posting-account=xH38FQoAAACTEQrejWyphubJikwRiF5i
NNTP-Posting-Host: 108.48.23.111
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6294a38a-d7cb-4ec4-8b47-025915bde02cn@googlegroups.com>
Subject: /dev/stdin on an Event Stream
From: stbalbach2@gmail.com (Stephen)
Injection-Date: Sat, 12 Jun 2021 05:33:57 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Stephen - Sat, 12 Jun 2021 05:33 UTC

I have an gawk program that takes as input Events Stream

$CURL -s https://domain.com/path-to-stream | prog.awk

prog.awk
----
while ((getline line < "/dev/stdin") > 0) {
<does a lot of stuff>
}

So far it is working great (yay awk), but I wonder because "does a lot of stuff" might take a while some seconds, and I don't want to drop any incoming stream, which can be a lot. Not even sure what is doing the buffering - the OS via the pipe? Curl? Awk? Can data be lost without knowing? Thanks for any insight.

Re: /dev/stdin on an Event Stream

<sa1q91$j4h$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=799&group=comp.lang.awk#799

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: /dev/stdin on an Event Stream
Date: Sat, 12 Jun 2021 10:12:17 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 35
Message-ID: <sa1q91$j4h$1@news-1.m-online.net>
References: <6294a38a-d7cb-4ec4-8b47-025915bde02cn@googlegroups.com>
NNTP-Posting-Host: 2001:a61:252a:da01:f478:8947:c0dc:d2d0
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1623485537 19601 2001:a61:252a:da01:f478:8947:c0dc:d2d0 (12 Jun 2021 08:12:17 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Sat, 12 Jun 2021 08:12:17 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <6294a38a-d7cb-4ec4-8b47-025915bde02cn@googlegroups.com>
 by: Janis Papanagnou - Sat, 12 Jun 2021 08:12 UTC

On 12.06.2021 07:33, Stephen wrote:
> I have an gawk program that takes as input Events Stream
>
> $CURL -s https://domain.com/path-to-stream | prog.awk
>
> prog.awk
> ----
> while ((getline line < "/dev/stdin") > 0) {
> <does a lot of stuff>
> }

This fragment (with <does a lot of stuff> expanded) is not a correct
awk program. (Is that code in a BEGIN block? Is there a #! line at
top?)

Why don't you just write

{ line = $0 ; <does a lot of stuff> }

> So far it is working great (yay awk), but I wonder because "does a
> lot of stuff" might take a while some seconds, and I don't want to
> drop any incoming stream, which can be a lot. Not even sure what is
> doing the buffering - the OS via the pipe? Curl? Awk? Can data be
> lost without knowing? Thanks for any insight.
>

What format has the "Events Stream" data? Is it line-oriented text?
Binary data? (Is the awk text processor the right tool for that data?)

All data from curl (assuming that is what's hidden in the CURL shell
variable) will be passed to awk, neither the OS nor awk "drop" data
passed through the pipe.

Janis

Re: /dev/stdin on an Event Stream

<sa2eep$s31$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=800&group=comp.lang.awk#800

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.lang.awk
Subject: Re: /dev/stdin on an Event Stream
Date: Sat, 12 Jun 2021 08:56:40 -0500
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <sa2eep$s31$1@dont-email.me>
References: <6294a38a-d7cb-4ec4-8b47-025915bde02cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 12 Jun 2021 13:56:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5d44f616228772e0063e276b7fe1be37";
logging-data="28769"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/M5FnRUgO+wYNNGiL50oyG"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:NLt29xwibbJ6LLREHSbMe1UNu+4=
In-Reply-To: <6294a38a-d7cb-4ec4-8b47-025915bde02cn@googlegroups.com>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 210612-0, 06/11/2021), Outbound message
 by: Ed Morton - Sat, 12 Jun 2021 13:56 UTC

On 6/12/2021 12:33 AM, Stephen wrote:
> I have an gawk program that takes as input Events Stream
>
> $CURL -s https://domain.com/path-to-stream | prog.awk
>
> prog.awk
> ----
> while ((getline line < "/dev/stdin") > 0) {
> <does a lot of stuff>
> }
>
> So far it is working great (yay awk), but I wonder because "does a lot of stuff" might take a while some seconds, and I don't want to drop any incoming stream, which can be a lot. Not even sure what is doing the buffering - the OS via the pipe? Curl? Awk? Can data be lost without knowing? Thanks for any insight.
>

If "does a lot of stuff" takes some seconds then that "stuff" is almost
certainly not just manipulating text and so I suspect you're trying to
use awk like a shell and calling external tools from it. That's probably
a bad idea. If you'd like help post a minimal, complete script along
with concise, testable sample input (output of curl) and expected output
so we can help you.

Ed.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor