[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Waiting for outpu

From: Stephane Chazelas
Subject: Re: Waiting for outpu
Date: Wed, 11 Jun 2008 17:51:10 +0100
User-agent: Mutt/1.5.16 (2007-09-19)

On Tue, Jun 10, 2008 at 06:11:26PM -0700, stoyboy wrote:
> I am trying to create a script that will run continuously until the out of a
> command reaches a specific point.
> I have a command called showOutput and all it does it output the progress of
> running job, i want to create a script or a command that will process this
> output and do something else once it sees the job has gotten to a specific
> point. What I have come up with so far is something like this:
> #this will give me only the 1 specific line i am waiting to see
> showOutput | grep "condition"

showOutput | sed '/condition/q'


showOutput | sed '/condition/!d;q'
if you want only that line to be printed.

showOuput will only be killed once it tries to write
something again after sed has terminated.

Some sed implementations read one line in advance, so that sed
may only quit after the condition line has been reached so that
showOuput may have to output 2 more lines before being killed.

Note that GNU grep has:

showOuput | grep -m1 condition


reply via email to

[Prev in Thread] Current Thread [Next in Thread]