Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Redirecting stdout into several programs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
LonelyStar
Guru
Guru


Joined: 06 Dec 2005
Posts: 390

PostPosted: Wed Feb 27, 2008 11:29 pm    Post subject: Redirecting stdout into several programs Reply with quote

Hi,

I want to write a bash script wich analyzes an email, it gets from stdin using the mess822 packet.
I want to extract the from and the to field.
I can extract the from field like this:

from_line=`822field from`

Which takes stdin and extracts the from field.
Can do the same with the to field, but how can I do both? After the line above, there is no stdin left for

to_line=`822field to`

to analyze. How can I pipe stdin into both comands?

Thanks!
Nathan
Back to top
View user's profile Send private message
didymos
Advocate
Advocate


Joined: 10 Oct 2005
Posts: 4798
Location: California

PostPosted: Thu Feb 28, 2008 12:30 am    Post subject: Reply with quote

Try the 'tee' command. It can copy stdin to stdout and multiple files; you can also copy to stdout more than once.
_________________
Thomas S. Howard
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum