The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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-19-2006 01:15 AM
tail command.. amon Shell Programming and Scripting 2 06-02-2006 04:36 AM
Help on scripting using tail jisc Shell Programming and Scripting 4 05-19-2006 03:15 AM
how to sed with tail redlotus72 UNIX for Dummies Questions & Answers 1 08-30-2005 05:27 AM
using tail -f cdunavent Shell Programming and Scripting 6 10-23-2002 05:10 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-10-2007
wannalearn wannalearn is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 33
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?
  #2 (permalink)  
Old 04-10-2007
srikanthus2002's Avatar
srikanthus2002 srikanthus2002 is offline
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...
  #3 (permalink)  
Old 04-10-2007
wannalearn wannalearn is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 33
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
  #4 (permalink)  
Old 04-10-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

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 05:07 PM..
  #5 (permalink)  
Old 04-10-2007
sami98 sami98 is offline
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'
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0