Sponsored Content
Top Forums Shell Programming and Scripting script not working after "tail -f" Post 302124504 by xander on Sunday 1st of July 2007 03:58:15 PM
Old 07-01-2007
Network script not working after "tail -f"

Hi Everyone ,

I am facing a strange problem
i have made the follwing script to watch a appending log file (abc.log) but its not moving after the line tail -f ,
any suggestions

=====================================
#!/bin/bash
while true
do
tail -f abc.log | grep "exceptions"
echo hi
done
===================================

but the script keeps on giving the exceptions output as follows:

exception.TaxStrategyException: Error during port.getTax
exception.InterfaceException: Error MNP duplicate found
exception.CardPaymentException: Payment gateway rejected

and i want the out put to be as follows :------
exception.TaxStrategyException: Error during port.getTax
hi
exception.InterfaceException: Error MNP duplicate found
hi
exception.CardPaymentException: Payment gateway rejected
hi
================================================

the basic problem i have seen is that tail -f keeps on checking the appending log file due to which it doesnot ends up and the second command
echo hi never gets executed.

Please help me if there is any other way of doing this

Thanks
SmilieSmilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl - immitate perpetual "tail"

Is there some way I can have a script monitor the newest line of a log file until a certain entry gets placed in the log? Basically I want to start this script, and have it spit up the last 10 lines or so to a browser via AJAX... the AJAX is not my problem though, as I have no idea how to go... (4 Replies)
Discussion started by: jjinno
4 Replies

2. Shell Programming and Scripting

Script not working..."sort" not working properly....

Hello all, I have a file - 12.txt cat 12.txt =============================================== Number of executions = 2 Total execution time (sec.ms) = 0.009883 Number of executions = 8 Total execution time (sec.ms) = 0.001270 Number of... (23 Replies)
Discussion started by: Rahulpict
23 Replies

3. Shell Programming and Scripting

"sed" command is not working in shell script

Hi All, I am not much strong in shell scripting... I am using sed command in my script to find and replace a string....... This is how script looks : ############# #!/usr/bin/ksh CONFIG_FILE=iom_test.txt FIND=`echo "NIS_FTP_SERVER1=123.456.iom.com"` REPLACE=`echo... (2 Replies)
Discussion started by: askumarece
2 Replies

4. UNIX for Dummies Questions & Answers

using "tail -f" in script

I am trying to use this script however it is not running well #!/bin/sh tail -f filename | grep -i -E 'error|warning' the code does not display the first 10 lines of the file that I want to check since after the file grow, it cannot grep "warning" as well #!/bin/sh A=`tail -f filename... (5 Replies)
Discussion started by: ikeQ
5 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. UNIX for Dummies Questions & Answers

"tail -n 1 filename" error while "head -n 1 filename" is ok?

Hi all, I was wondering why tail -n 2 filename produce an error when I manage to do similar command on head -n 2 filename SunOS{type8code0}: tail -n 2 filename usage: tail ] tail ] (2 Replies)
Discussion started by: type8code0
2 Replies

7. Shell Programming and Scripting

"find . -printf" without prepended "." path? Getting path to current working directory?

If I enter (simplified): find . -printf "%p\n" then all files in the output are prepended by a "." like ./local/share/test23.log How can achieve that a.) the leading "./" is omitted and/or b.) the full path to the current directory is inserted (enclosed by brackets and a blank)... (1 Reply)
Discussion started by: pstein
1 Replies

8. Shell Programming and Scripting

"if" Loop not working when executing script using cron

I am facing this weird issue where the script is working fine from the command line but when I am executing it from cron though it is working fine but the "if" loop is processing else part though I know that the if part of the logic is true and ideally the loop should execute the if portion. ... (3 Replies)
Discussion started by: sk2code
3 Replies

9. UNIX for Beginners Questions & Answers

Automate "touch" bash script not working.

#!/bin/bash -i SAVEIFS=$IFS IFS=$"\n\b" picc=$* if ; then echo $TDATE if ; then touch dummy touch -t "tdate" dummy touch -r "dummy" "$picc" else echo -e "No mod date value to apply. If there is one in your shell,\ninvoke \eStarted asking advice on this (on Linuxquestions.org).... (9 Replies)
Discussion started by: iamwrong
9 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
log2(3M)						  Mathematical Library Functions						  log2(3M)

NAME
log2, log2f, log2l - compute base 2 logarithm functions SYNOPSIS
cc [ flag... ] file... -lm [ library... ] #include <math.h> double log2(double x); float log2f(float x); long double log2l(long double x); DESCRIPTION
These functions compute the base 2 logarithm of their argument x, log2(x). RETURN VALUES
Upon successful completion, these functions return the base 2 logarithm of x. If x is +-0, a pole error occurs and log2(), log2f(), and log2l() return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, respectively. For finite values of x that are less than 0, or if x is -Inf a domain error occurs and a NaN is returned. If x is NaN, a NaN is returned. If x is 1, +0 is returned. If x is +Inf, x is returned. ERRORS
These functions will fail if: Domain Error The finite value of x is less than 0, or x is -Inf. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid floating-point exception is raised. Pole Error The value of x is 0. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the divide-by-zero floating-point exception is raised. USAGE
An application wanting to check for exceptions should call feclearexcept(FE_ALL_EXCEPT) before calling these functions. On return, if fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an exception has been raised. An application should either examine the return value or check the floating point exception flags to detect exceptions. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
feclearexcept(3M), fetestexcept(3M), log(3M), math.h(3HEAD), attributes(5), standards(5) SunOS 5.10 1 Sep 2002 log2(3M)
All times are GMT -4. The time now is 05:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy