Re: adding leading characters to stdout

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 04/29/04


Date: Thu, 29 Apr 2004 02:26:59 -0400

In article <55b982c8.0404282111.4a893ce3@posting.google.com>,
 sspark@hi.snu.ac.kr (SeungSeop, Park) wrote:

> Hi.
> I want to organize the output of a program such that sub-program's
> outputs start with some leading charactors :
> -------------------------------------
> :
> normal program output comes here
> :
> :
> >
> > sub-program outputs start with ' >' characters
> >
> --------------------------------------
>
> To do that, i made a shell scripts :
> -------------------------
> # /bin/sh
> ...
> noraml_prog
> ...
> sub_prog 2>&1 | sed -e 's/^/ >/'
> ...
> ---------------------------
> This works. But, because a pipe buffers the output of a program, there
> are long delays before I can see any output.
>
> Is there any idea??

Use the "unbuffer" script from the Tcl/Expect distribution.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***