zsh-users
 help / color / mirror / code / Atom feed
From: Dominik Vogt <dominik.vogt@gmx.de>
To: Zsh Users <zsh-users@zsh.org>
Subject: Clustered output of a function
Date: Wed, 10 Feb 2021 12:31:19 +0100	[thread overview]
Message-ID: <20210210113119.GA2435@gmx.de> (raw)

There is a shell function that takes input from stdin, processes
that and responds by printing multiple lines to stdout for each
line in stdin, E.g.

  input line 1 ->
    output A1
    output B1
  input line 2 ->
    output C2
  input line 2 ->
    output A3
    output B3

I.e. the output order is

  A1 B1 C2 A3 B3.

Now, all A-lines should be in a block before all other output lines:

  A1 A3 B1 C2 B3

The point is, I'm looking for a way to do this (a) without using
temporary files, (b) without parsing the input twice, and (c)
without buffering the output in variables.

--

Is there a nice way to "park" the second block of output somewhere
and emit it just before the function terminates?

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt


                 reply	other threads:[~2021-02-10 11:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210210113119.GA2435@gmx.de \
    --to=dominik.vogt@gmx.de \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).