you might want to check out the  tee  command which splits a pipe.
frinstance.

grep foo log/access.log | cut -d' ' -f1|tee -a bar|nslookup > baz

will store a list of ip addresses in bar and hostnames in baz

http://www.efn.org/~laprice        ( Community, Cooperation, Consensus
http://www.opn.org                 ( Openness to serendipity, make mistakes
http://www.efn.org/~laprice/poems  ( but learn from them.(carpe fructus ludi)
http://allie.office.efn.org/phpwiki/index.php?OregonPublicNetworking
On Thu, 1 Nov 2001, Cory Petkovsek wrote:

> I'm working on creating a centralized logging facility for my NT servers.
> Currently my linux servers email me highlights of their logs using logcheck.
> 
> 
> Through this process, I discovered some interesting redirection usage that I
> hadn't seen before:
> "eldump -? 2>&1 | more"
> 
> I figure this means take standard error(2) and merge it with standard
> out(1).  Right?
> 
> Here are some experiments I ran:
> $ prog 1>d 1>j
> 
> stdout went to j
> d is empty
> 
> $ prog 1>d 2>&1 1>j
> 
> stdout went to j
> stderr went to d
> 
> How many streams are there?  Can I do something like
> $ prog 1>&4 4>&3 1>j 3>&5  5>&2
> 
> Can I fork a stream?  Maybe like:
> $ prog 1>&3>&4 3>file1 4>file2
> 
> What other tricks can I do with streams?  Can I take stdout and route it in
> to stdin, thus making a superconducter inside my shell?
> $ prog 1>&3 <&3
> or maybe just
> $ prog <&1
> hmm, I just did:
> $ cat <&1
> but it wasn't very interesting.  Same as 'cat'
> 
> What about pipes?
> $ prog 1|'perl -pe \'s....\'' 2|wc -l....
> 
> 
> Thanks,
> Cory
> 

Reply via email to