Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Clustered output of a function



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




Messages sorted by: Reverse Date, Date, Thread, Author