The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Tail?? qfwfq Shell Programming and Scripting 7 06-18-2006 10:15 PM
tail command.. amon Shell Programming and Scripting 2 06-02-2006 01:36 AM
Help on scripting using tail jisc Shell Programming and Scripting 4 05-19-2006 12:15 AM
how to sed with tail redlotus72 UNIX for Dummies Questions & Answers 1 08-30-2005 02:27 AM
using tail -f cdunavent Shell Programming and Scripting 6 10-23-2002 02:10 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-10-2007
Registered User
 

Join Date: Feb 2007
Posts: 30
tail -f

I am trying to extract a particular line from a.log which keeps appending every sec and output that into a newfile b.log which should append itself with filtered data received from a.log

I tried

tail -f a.log |grep fail| tee -a b.log

nothing in b.log

tail -f a.log |grep fail >>b.log

nothin shows up in b.log

what am i missing?

Is there an option similar to tail -f with awk?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-10-2007
srikanthus2002's Avatar
Registered User
 

Join Date: Sep 2006
Location: Can u guess...!
Posts: 160
"tail -f" command shows just last 10 lines and it keeps on refreshing...

Can you show us output of "tail -f a.log | grep fail" ?


It would be helpout to give a suggesion...
Reply With Quote
  #3 (permalink)  
Old 04-10-2007
Registered User
 

Join Date: Feb 2007
Posts: 30
hi

tail -f just displays the realtime appended output of the file...not just the 10lines

anyways i figured out a way using awk..but would gr8 if we can do it using grep
Reply With Quote
  #4 (permalink)  
Old 04-10-2007
Shell_Life's Avatar
Unix/Informix/4GL/SQL
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
wannalearn,
Would this work for you:
Code:
while true
do
  egrep 'fail' a.log > b.log
  sleep 1
done
Code:


Last edited by Shell_Life; 04-10-2007 at 02:07 PM.
Reply With Quote
  #5 (permalink)  
Old 04-10-2007
Registered User
 

Join Date: Mar 2007
Posts: 10
if u r using linux, u could try:
watch -n 1 'egrep fail a.log > b.log'
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0