Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tail the output and run another script without forking

Status
Not open for further replies.

max1x

Programmer
Jan 12, 2005
366
0
0
US
My first script creates an output file, which the second script needs to parse real-time. Using system command, I was teeing and tailing the files as follows

system("sc1.pl | tee out1.out | tail -f out1.out | sc2.pl | tee out2.out");

Both the output files get created but are empty. I can't install any modules on the machine I'm on so forking is not possible. Any simple solution I'm overlooking?
 
why not use multiple system calls instead of trieng to pipe them all?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
I tried that as well. The 1st output files starts and increments, but it's does not seem to get tailed for input for the second script.
 
idk, what your doing just seems incorrect but maybe I don't understand. D

o you control scp1 and scp2. Is this a daemon of some kind or does it just run once?

If it just runs once why isn't it all in one script?

Can you just call scp1 > out1.out.
then call cat out1.out | scp2 > out2.out ?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
it works when I do it in a different term window. I'm tring to do real time parsing. The output files have rw for the users, so I don't think it's locked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top