Re: Process Synchronization using Pipes
- From: Barry Margolin <barmar@xxxxxxxxxxxx>
- Date: Sun, 25 Mar 2007 20:45:02 -0400
In article <1174862813.738202.285660@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Arturo" <arturo.rotondo@xxxxxxxxx> wrote:
Hey,
I need to have 4 processes: Producer, Filter1, Filter2 and Consumer.
Producer needs to read data from an input file line by line and pass
each line via a pipe to Filter1 who will replace all " " w/ "*". Once
Filter1 is done it will pass the newly modified line to Filter2.
Filter2 converts all lowercase letters to uppercases. Once Filter2 is
done it will pass the newly modified line to Consumer who simply
writes the line to an output file. This is repeated until the input
file is completely scanned.
I can get this to work w/ one line (no loops), so the first line of
text is completely converted but how do I get a while() loop to work
with this pipe synchronization so that the entire input file is
scanned?
I'd appreciate it if someone can help.
I'm not sure what the problem is. As long as all the processes read
their input line by line until EOF, you should be able to do:
Producer | Filter1 | Filter2 | Consumer
Are you saying that some of these processes only process one line and
then exit? You can change that process to:
{ while read line; do echo "$line" | <process>; done; }
--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.
- Follow-Ups:
- Re: Process Synchronization using Pipes
- From: Arturo
- Re: Process Synchronization using Pipes
- References:
- Process Synchronization using Pipes
- From: Arturo
- Process Synchronization using Pipes
- Prev by Date: Re: Q. Using VPATH in make ?
- Next by Date: [OT] Re: branch prediction optimization
- Previous by thread: Process Synchronization using Pipes
- Next by thread: Re: Process Synchronization using Pipes
- Index(es):
Relevant Pages
|