LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-11-2005, 05:35 AM   #1
promero
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Rep: Reputation: 0
noob Pipeline help.


I have been searching for hours and hours but I cant find the answer to this problem.

I have a simple pipeline that reads:

command1 | command2 | tee /dev/tty | command3

The problem is the when 'tee /dev/tty' displays the output to my terminal there is so much data that it goes off the screen. I have tried redirecting to 'more' and 'less' but that does not work.

Is there anyway to page the output of 'tee /dev/tty' ?

Please help this

Thanks in advance,
 
Old 09-11-2005, 05:51 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
try:
Code:
command1 | command2 | tee /tmp/out | more ; command3 < /tmp/out
 
Old 09-11-2005, 01:00 PM   #3
promero
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you sooo much!

You rule! That worked like a charm Now I am going to up on the syntax you used. (I do not understand why this command does not work with a | to the last command instead of ; )

Thanks again for such a great responce to my first post.
 
Old 09-11-2005, 01:16 PM   #4
arpanet1969
LQ Newbie
 
Registered: Dec 2004
Location: On your SQL server.
Distribution: Mandrivia Linux 10.1
Posts: 25

Rep: Reputation: 15
I'm pretty much a n00b myself (even tho i've been using *nix for a few years LOL) but you could send the output of tee to a file, allowing you to read it at a later date:

Code:
command 1 | command 2 | tee /tmp/out >filename.ext | command 4
No?
 
Old 09-11-2005, 01:47 PM   #5
promero
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Original Poster
Rep: Reputation: 0
that's

arpanet1969,

Thanks for your reply.

Redirecting the 'tee' output to a file to read later is a good idea too. But in this case I wanted to use 'tee /dev/tty' to check the output of part of my pipe as the pipeline ran. (Plus I needed to learn how to page the output of 'tty' for a class I'm taking)
 
Old 09-11-2005, 02:02 PM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
No.
A command output can't go at the same time to a pipe and to a redirection, at least that way.
 
Old 09-11-2005, 03:00 PM   #7
promero
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Original Poster
Rep: Reputation: 0
would it have to be:

command1 | command2 | tee outfile.txt | command3

?
 
Old 09-11-2005, 03:12 PM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
That one works, but doesn't answers your original question which is how to have one program stdout going to two different programs.
 
Old 09-11-2005, 03:42 PM   #9
promero
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by jlliagre
but doesn't answers your original question which is how to have one program stdout going to two different programs.
Thanks jlliagre,

Your right. Your original answer was what I was looking for... my second question was just purely academic.



 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C(sockets):how to implement persistent and pipeline supermyself Programming 0 06-09-2005 12:42 PM
Having a tough time with K-shell pipeline pjz Programming 4 03-24-2005 03:05 PM
pipeline buffering jk3us Linux - Software 2 12-17-2004 07:52 PM
pipeline using rm verstapp Linux - General 3 03-08-2004 11:33 PM
Pipeline implementation in C jiahe Programming 1 02-02-2003 05:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration