Sponsored Content
Top Forums Shell Programming and Scripting Stopping tail -f when certain string found? Post 302235422 by jake657 on Friday 12th of September 2008 01:20:29 AM
Old 09-12-2008
Quote:
Originally Posted by Annihilannic
Try:

Code:
  tail -f $VAULogFile | awk '/Phase/;/Phase 2 ended/ { exit }'

No need for a kill, the tail should terminate automatically when the pipe is closed.
That worked like a charm. Thank you very much, sir.



Thanks also, Chr15. I didn't really want to resort to a kill if possible but I appreciate your help. Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Searching for file and stopping at first item found

Hello, I try to write a shell script that would list all files on a directory and stop when it finds the first item specified on a find or ls command. How can I tell to the find or ls command to stop when it finds the first ".doc" file for example ? Thank you (7 Replies)
Discussion started by: davchris
7 Replies

2. Shell Programming and Scripting

bash script tail when string found do something

Okay, I have two scripts, the first one does some stuff, and comes to a point where it has this: Right here it runs a quick script to start something that writes to a log file. /usr/bin/tail -f ${pathVar}/nohup_${servVar}.out | while read -r line do ] && continue cd ${pathVar}... (0 Replies)
Discussion started by: cbo0485
0 Replies

3. Solaris

Can't install Unicode::String due to String.so not found

CPAN.pm: Going to build G/GA/GAAS/Unicode-String-2.09.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Unicode::String cp String.pm blib/lib/Unicode/String.pm cp lib/Unicode/CharName.pm blib/lib/Unicode/CharName.pm /usr/bin/perl /usr/perl5/5.8.4/lib/ExtUtils/xsubpp... (5 Replies)
Discussion started by: PatrickBaer
5 Replies

4. UNIX for Dummies Questions & Answers

How to Tail for a specific string

Hi guys i am tailing a constantly appending log file. However, I am looking for some specific word to be seen only when there is an update. How should I look for the word "{test-0101}" in tail, so that it only shows when there is a line that contains {test-0101} ? Thanks (1 Reply)
Discussion started by: DallasT
1 Replies

5. Linux

Find String in FileName and move the String to new File if not found

Hi all, I have a question.. Here is my requirement..I have 500 files in a path say /a/b/c I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
1 Replies

6. Shell Programming and Scripting

grep on string and printing line after until another string has been found

Hello Everyone, I just started scripting this week. I have no background in programming or scripting. I'm working on a script to grep for a variable in a log file Heres what the log file looks like. The x's are all random clutter xxxxxxxxxxxxxxxxxxxxx START: xxxxxxxxxxxx... (7 Replies)
Discussion started by: rxc23816
7 Replies

7. Shell Programming and Scripting

Grep a string and write a value to next line of found string

Hi, I have two variables x and y. i need to find a particular string in a file, a workflow name and then insert the values of x and y into the next lines of the workflow name. basically it is like as below wf_xxxxxx $$a= $$b= $$c= figo $$d=bentley i need to grep the 'wf_xxxx' and then... (6 Replies)
Discussion started by: angel12345
6 Replies

8. UNIX for Dummies Questions & Answers

Append a string on the next line after a pattern string is found

Right now, my code is: s/Secondary Ins./Secondary Ins.\ 1/g It's adding a 1 as soon as it finds Secondary Ins. Primary Ins.: MEDICARE B DMERC Secondary Ins. 1: CONTINENTAL LIFE INS What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
Discussion started by: newbeee
4 Replies

9. Shell Programming and Scripting

stopping tail function after ctrl + c

say i have a statement like this in a script tail -f /opt/blah/blha/user.log > final.log if ;then cat final.log | grep -i "servicer_user" > service.log cat final.log | grep -i "logic_user" > logic.log fi echo "script completed" but when the script is running if i press ctrl + c the... (4 Replies)
Discussion started by: vivek d r
4 Replies

10. Shell Programming and Scripting

Get 20 lines above string found, and 35 below string

i want to search a log for a string. when that string is found, i want to grab the a set number of lines that came before the string, and a set number of lines that come after the string. so if i search for the word "Error" in the /var/log/messages file, how can I output the 20 lines that came... (4 Replies)
Discussion started by: SkySmart
4 Replies
TAU_PHASE_CREATE_STA(3) 				      TAU Instrumentation API					   TAU_PHASE_CREATE_STA(3)

NAME
TAU_PHASE_CREATE_STATIC - Defines a static phase. SYNOPSIS
C/C++: TAU_PHASE_CREATE_STATIC(Phase phase, char* or string& function_name, char* or string& type, TauGroup_t group); Fortran: TAU_PHASE_CREATE_STATIC(integer phase(2), character name(size)); DESCRIPTION
TAU_PHASE_CREATE_STATIC creates a static phase. Static phases (and timers) are more efficient than dynamic ones because the function registration only takes place once. EXAMPLE
C/C++ : int f2(void) { TAU_PHASE_CREATE_STATIC(t2,"IO Phase", "", TAU_USER); TAU_PHASE_START(t2); input(); output(); TAU_PHASE_STOP(t2); return 0; } Fortran : subroutine F2() integer phase(2) / 0, 0 / save phase call TAU_PHASE_CREATE_STATIC(phase,'IO Phase') call TAU_PHASE_START(phase) call INPUT() call OUTPUT() call TAU_PHASE_STOP(phase) end SEE ALSO
TAU_PHASE_CREATE_DYNAMIC(3), TAU_PHASE_START(3), TAU_PHASE_STOP(3) 08/31/2005 TAU_PHASE_CREATE_STA(3)
All times are GMT -4. The time now is 11:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy