Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.system > #53391 > unrolled thread

Unix Q: "tee"

Started byjohn hevelin <bwotte@panix.com>
First post2013-12-16 05:34 +0000
Last post2013-12-16 12:30 -0500
Articles 2 — 2 participants

Back to article view | Back to comp.sys.mac.system


Contents

  Unix Q: "tee" john hevelin <bwotte@panix.com> - 2013-12-16 05:34 +0000
    Re: Unix Q: "tee" Barry Margolin <barmar@alum.mit.edu> - 2013-12-16 12:30 -0500

#53391 — Unix Q: "tee"

Fromjohn hevelin <bwotte@panix.com>
Date2013-12-16 05:34 +0000
SubjectUnix Q: "tee"
Message-ID<l8m3ds$4hh$1@reader1.panix.com>
I'm not sure if this is what the original poster was looking for.
My understanding is that he wanted to direct the standard output
of a command into two or more scripts that could run in parallel
using the tee(1) command.  I think this works:

% cat script0
#! /bin/bash
sed '20q' /usr/share/dict/words | tee >(./script1) | ./script2

% cat script1
#! /bin/bash
tr -d aeiou > script1.out

% cat script2
#! /bin/csh
tr -d tnshr > script2.out

% ./script0

% cat script1.out
A


l
l
m
An
rdvrk
rdwlf
Arn
Arnc
Arncl
Arnt
Arntc
Ar
Ab
b
Abbdh
Abb
bc

% cat script2.out
A
a
aa
aal
aalii
aam
Aai
aadvak
aadwolf
Aao
Aaoic
Aaoical
Aaoie
Aaoiic
Aau
Ab
aba
Ababde
Ababua
abac

It occurrs to me that if either script1 or script2 will be long
running that it might be expedient to run them in the background.
I'm not sophisticated enough with either sh(1) or bash(1) to know
how to do this, but maybe job control would suffice.

[toc] | [next] | [standalone]


#53395

FromBarry Margolin <barmar@alum.mit.edu>
Date2013-12-16 12:30 -0500
Message-ID<barmar-A37D85.12301616122013@news.eternal-september.org>
In reply to#53391
In article <l8m3ds$4hh$1@reader1.panix.com>,
 john hevelin <bwotte@panix.com> wrote:

> I'm not sure if this is what the original poster was looking for.
> My understanding is that he wanted to direct the standard output
> of a command into two or more scripts that could run in parallel
> using the tee(1) command.  I think this works:
> 
> % cat script0
> #! /bin/bash
> sed '20q' /usr/share/dict/words | tee >(./script1) | ./script2

This is the solution I posted earlier in the thread.

BTW, your newsreader seems to be breaking the thread -- there's no 
"References" or "In-Reply-To" header in your message, and the subject 
doesn't begin with "Re:".

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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.mac.system


csiph-web