zsh-users
 help / color / mirror / 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?

Ciao

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

zsh-users

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-users

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-users zsh-users/ http://inbox.vuxu.org/zsh-users \
		zsh-users@zsh.org
	public-inbox-index zsh-users

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git