Sponsored Content
Full Discussion: Grep command in a loop
Top Forums UNIX for Beginners Questions & Answers Grep command in a loop Post 303017477 by Corona688 on Wednesday 16th of May 2018 01:37:53 PM
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
Code:
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.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep in a loop

Hi , I am trying a script which takes user input userid . I am stuck how to check whether that is a valid user id or not in the audit log files. My code is : cd $CCP_AUDIT cat * > /export/home/$USR/l***/files echo "UserId:\c" read UserId #Date Function echo "DATE : \c" read xxx I... (7 Replies)
Discussion started by: gundu
7 Replies

2. UNIX for Dummies Questions & Answers

grep -v while loop

alist contain: a b c d e blist contain: a b c the code: #!/usr/bin/ksh cat blist | while read line do grep -V "$line" alist > data done (8 Replies)
Discussion started by: bobo
8 Replies

3. Shell Programming and Scripting

Grep commands in loop

Hi All, Reference to my previous post I need to compare all the lines in the file1 with file2 for this condition if file1 {$3,$5} ==file2 {$3,$5} then grep file2{$1}latest date. need output in file3 10/04/2008 09/04/2008 09/04/2008 08/04/2008 can anyone suggest me Thanks... (0 Replies)
Discussion started by: karthikn7974
0 Replies

4. Shell Programming and Scripting

grep and loop files

Hi , 1. I want to grep two or three lines from a set of files and put the grepped lines into again a set of files.like file1-greppedfile1 file2-greppedfile2 then again do some format to the grepped files with sed or awk then create another set of files. How can I do this in loop? 2.I... (4 Replies)
Discussion started by: kashik
4 Replies

5. Shell Programming and Scripting

Help with grep inside an if loop

Hello All, I have been reading posts on here for a while, but this is my first post. I have a document in which many sentences appear, and I am piping it through an exterior script which will tag each word in the document with its part of speech (not part of my script, just background). The... (3 Replies)
Discussion started by: daf189
3 Replies

6. Shell Programming and Scripting

Using grep within a while loop

Hi all, I have the below script to get input but i cannot get grep to work. input1.txt AAAAAAAAG input2.txt >gi|184009.1| LEAFY-like |AAAAAAAAGSGGGDHLPY However, when i use grep -f input1.txt input2.txt i cannot get any output matches (note that the match is underlined). Is it... (8 Replies)
Discussion started by: turkishvan
8 Replies

7. Shell Programming and Scripting

Help on grep in a do while loop

So this is what I'm trying to do: I have a file called registry.txt which has a list of registry entries I want to search for. I have another file called inctrl.txt on which I want to perform the search on. Here's the example contents of registry.txt SOFTWARE\Microsoft\Security... (3 Replies)
Discussion started by: r4v3n
3 Replies

8. Red Hat

using grep in a while loop

Hello everybody, I have been searching it, but it seems I am unable to find the correct information, that s why I am asking you guys, hoping somebody get an idea. Here is my problem : I want a script to loop until a string is identified in a log file. Here is the script : #!/bin/sh... (5 Replies)
Discussion started by: guyiom
5 Replies

9. Homework & Coursework Questions

GREP loop

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I need to search through the users home directories for keywords, display them. The code listed below will show... (7 Replies)
Discussion started by: jcllns1
7 Replies

10. Shell Programming and Scripting

Ps ax with grep in loop

Hello, I have built the following script to check if processes supplied by the argument are running or not. #!/bin/bash PROCLIST=$1 PROCESS="0" ERROR_PROCS="" IFS='+' read -ra ADDR <<< "$PROCLIST" for PROC in "${ADDR}"; do if ; then PROCESS=1 ... (9 Replies)
Discussion started by: nms
9 Replies
IPTRAF(8)						      System Manager's Manual							 IPTRAF(8)

NAME
iptraf - Interactive Colorful IP LAN Monitor SYNOPSIS
iptraf { [ -f ] [ -q ] [ { -i iface | -g | -d iface | -s iface | -z iface | -l iface } [ -t timeout ] [ -B [ -L logfile ] ] ] | [ -h ] } DESCRIPTION
iptraf is an ncurses-based IP LAN monitor that generates various network statistics including TCP info, UDP counts, ICMP and OSPF informa- tion, Ethernet load info, node stats, IP checksum errors, and others. If the command is issued without any command-line options, the program comes up in interactive mode, with the various facilities accessed through the main menu. OPTIONS
These options can also be supplied to the command: -i iface immediately start the IP traffic monitor on the specified interface, or all interfaces if "-i all" is specified -g immediately start the general interface statistics -d iface allows you to immediately start the detailed on the indicated interface (iface) -s iface allows you to immediately monitor TCP and UDP traffic on the specified interface (iface) -z iface shows packet counts by size on the specified interface -l iface start the LAN station monitor on the specified interface, or all LAN interfaces if "-l all" is specified -t timeout tells IPTraf to run the specified facility for only timeout minutes. This option is used only with one of the above parameters. -B redirect standard output to /dev/null, closes standard input, and forks the program into the background. Can be used only with one of the facility invocation parameters above. Send the backgrounded process a USR2 signal to terminate. -L logfile allows you to specify an alternate log file name. The default log file name is based on either the interface selected (detailed interface statistics, TCP/UDP service statistics, packet size breakdown), or the instance of the facility (IP traffic monitor, LAN station monitor). If a path is not specified, the log file is placed in /var/log/iptraf -f clears all locks and counters, causing this instance of IPTraf to think it's the first one running. This should only be used to recover from an abnormal termination or system crash. -q no longer needed, maintained only for compatibility. -h shows a command summary SIGNALS
SIGUSR1 - rotates log files while program is running SIGUSR2 - terminates an IPTraf process running in the background. FILES
/var/log/iptraf/*.log - log file /var/local/iptraf/* - important IPTraf data files SEE ALSO
Documentation/* - complete documentation written by the author AUTHOR
Gerard Paul Java (riker@mozcom.com) MANUAL AUTHOR
Frederic Peters (fpeters@debian.org), using iptraf --help General manual page modifications by Gerard Paul Java (riker@mozcom.com) IPTraf Help Page IPTRAF(8)
All times are GMT -4. The time now is 04:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy