Visit Our UNIX and Linux User Community

PIpe Spy

Thread Tools Search this Thread
Top Forums Programming PIpe Spy
# 1  
Old 02-15-2004
PIpe Spy

Im trying to get my program to behave in this way:

prog 1 | ./pipespy myfile.dat | prog2

the standard output of prog1 is supplied as the input to prog2 and copied into file myfile.dat.

need help
# 2  
Old 02-15-2004
You want the tee command.
prog 1 | tee myfile.dat | prog 2

If you want to append to myfile.dat, use:
prog 1 | tee -a myfile.dat | prog 2

What's PipeSpy btw?
# 3  
Old 02-16-2004
pipespy is a C++ program i was thinking of writing.
you prog1 and prog2 what type of files should it be? like should it be a C++ program,or just like text file?
# 4  
Old 02-16-2004
Originally posted by jodders
you prog1 and prog2 what type of files should it be? like should it be a C++ program,or just like text file?
Prog1 and Prog2 are any program (such as c++) or script(which is a text file) you want them to be... as long as Prog1 would normally send output to the screen, my line of code will redirect it into "myfile.dat" and also send it to "Prog2".
# 5  
Old 02-17-2004
Perhaps it could work out this way:

prog 1 | ./pipespy myfile.dat | prog2

The executable 'pipespy' should read the standard input and before writing the data to standard output store it within a file named 'myfile.dat'
# 6  
Old 02-17-2004
you prog1 and prog2 what type of files should it be?
these can be any executables. see the man pages for 'tee' and it gives a simple example using grep and wc.
# 7  
Old 02-17-2004
hey guys,thanks for a all your help,but i cant seem to get it working.i created prog1 and prog2 has a .txt file,and i keep getting

aspasia$ prog1.txt | tee -a myfile.dat | prog2.txt
-bash: prog1.txt: command not found
-bash: prog2.txt: command not found

any suggestions?

Previous Thread | Next Thread
Test Your Knowledge in Computers #83
Difficulty: Easy
BSD, Linux, Mac OS X, and other Unix-like operating systems did not inherit aspects of the original Unix design.
True or False?

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

2. Shell Programming and Scripting

Replace pipe with Broken Pipe

Hi All , Is there any way to replace the pipe ( | ) with the broken pipe (0xA6) in unix (1 Reply)
Discussion started by: saj
1 Replies

3. Solaris

Can we spy a tty session?

First of all, in no way I want to use this to hack / cheat / steal etc ... I am an admin of a couple of hundred users which are 99,8% > 500miles away from me and to facilitate some administration part I would like to be able to "spy" what they are doing in there sessions, live. ex: ... (7 Replies)
Discussion started by: plmachiavel
7 Replies

4. UNIX for Dummies Questions & Answers

i-spy for UNIX - What is it??

I'm just after finding a file resding in my temporary directory(/tmp) on my machine called 'i-spy' This file is owned by root and ordinary muppets like me cant delete it, open or even do a more or cat on it. I'm running Solaris 2.6 on a Sun Ultra 5. Can anyone out there give me a good... (1 Reply)
Discussion started by: Kanu77
1 Replies

5. Shell Programming and Scripting

Game spy arcade for halo and macintosh?

I need help i heard you can play halo over online and you have a macintosh version where can I get it please respond (1 Reply)
Discussion started by: memattmyself
1 Replies

6. Shell Programming and Scripting

"SPY" script - please help

hello guys, I'm in need of some help with a certain script. The link to my assignment is below...any and all advice/pointers/suggestions will be greatly appreciated. thanx, Jake Axon (2 Replies)
Discussion started by: Axon
2 Replies

Featured Tech Videos