help / color / mirror / code / Atom feed
* Clustered output of a function
@ 2021-02-10 11:31 Dominik Vogt
  0 siblings, 0 replies; only message in thread
From: Dominik Vogt @ 2021-02-10 11:31 UTC (permalink / raw)
  To: Zsh Users

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?


Dominik ^_^  ^_^


Dominik Vogt

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-10 11:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 11:31 Clustered output of a function Dominik Vogt

Code repositories for project(s) associated with this public inbox


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).