Home Man
Today's Posts

If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Grep command in a loop

Login to Reply

Thread Tools Search this Thread
# 1  
Old 05-16-2018
Grep command in a loop

Hello -

I am running a script that is outputting to a log. Let call it output.log
I would like to monitor that log until the line "Build Successful" is found.

I think I would need to use the grep command.
How would I do that in a loop?

# 2  
Old 05-16-2018
It'd be much better to watch the return code of the script if you can. Usually it will return 0 for success, anything else for error.

You can do
tail -f build.log | grep -l -q "Build Successful"

but if "Build Successful" never appears, it will wait forever.

The same problem faces any approach really. Without some way to tell when it's failed, it has no termination condition.
The Following User Says Thank You to Corona688 For This Useful Post:
RavinderSingh13 (05-16-2018)
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Ps ax with grep in loop nms Shell Programming and Scripting 9 07-11-2018 01:50 PM
GREP loop jcllns1 Homework & Coursework Questions 7 02-20-2013 09:54 PM
using grep in a while loop guyiom Red Hat 5 02-02-2012 11:26 AM
Help on grep in a do while loop r4v3n Shell Programming and Scripting 3 06-24-2011 02:21 PM
grep sed and a loop gunnahafta UNIX for Dummies Questions & Answers 3 05-12-2011 12:21 AM
Using grep within a while loop turkishvan Shell Programming and Scripting 8 04-23-2011 01:59 PM
grep within while read loop migurus Shell Programming and Scripting 6 10-24-2009 11:42 PM
Grep Different Files Using a Loop? foleyml Shell Programming and Scripting 6 01-02-2009 12:41 AM
grep -v while loop bobo UNIX for Dummies Questions & Answers 8 01-26-2007 09:53 PM
grep in a loop gundu Shell Programming and Scripting 7 03-28-2005 03:59 PM

All times are GMT -4. The time now is 08:35 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
Show Password