How do i use tail & grep in real time here??


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How do i use tail & grep in real time here??
# 8  
Old 04-24-2013
Yes. sorry, corrected it... try now.
# 9  
Old 04-24-2013
hanson & rudi

I want tof ind the word in real time....
if i use tail -f command i ll be ever stuck over there oly...

Please suggest sum alternate idea
# 10  
Old 04-24-2013
Did you try my grep -m suggestion?
# 11  
Old 04-24-2013
If the log file is part of log rotating do use --follow like this:
Code:
tail --follow=name logfile | grep -m 1 word_to_find

# 12  
Old 04-24-2013
it aint helping...

grep -m wil help me in serching the 1st occurence.
I'm not looking for that
# 13  
Old 04-24-2013
Depending on the OS flavour, you might be able to use:-
Code:
tail -0f filename | grep expression | while read line
do
   :
   :
   :

0 is a zero.

Some versions of HP-UX don't allow the zero lines option of tail, and there may be other flavours that do that too. I'm not sure why grep would give any output if the expression it not found.

Can you paste in the code you have so far?




Thanks, in advance,
Robin
# 14  
Old 04-24-2013
Quote:
grep -m wil help me in serching the 1st occurence.
I'm not looking for that
Then what are you looking for? I thought you wanted to take action when there was an occurence.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting real time to epoch time

# date +%s -d "Mon Feb 11 02:26:04" 1360567564 # perl -e 'print scalar localtime(1360567564), "\n";' Mon Feb 11 02:26:04 2013 the epoch conversion is working fine. but one of my application needs 13 digit epoch time as input 1359453135154 rather than 10 digit epoch time 1360567564... (3 Replies)
Discussion started by: vivek d r
3 Replies

2. Shell Programming and Scripting

How to tail real time file Generated every hour?

Hi Guys, I am developing a script to monitor log file Generated every hour. When creating a new file scripts not working. My Code . I want to monitor GatewayTransaction.yyyymmdd-hh.log while true; do newdate=$(date '+%Y%m%d') ; nowdate=$(date '+%Y%m%d-%H.log'); tail -f... (7 Replies)
Discussion started by: ooilinlove
7 Replies

3. UNIX Desktop Questions & Answers

grep a range of time & date

how can i grep a range? i have a text file with the following text: result.log.00:2012/01/02 12:00:07.422 LOG STARTED HERE N6Kashya29MemoryShieldScheduler_AO_IMPLE, pid=8662/8658, config=(alertThreshold=10,alertLevel=0,killThreshold=7200,coreThreshold=0,full=1), deltaTime=0,... (1 Reply)
Discussion started by: boaz733
1 Replies

4. Shell Programming and Scripting

How to tail -f real time file.

How to tail -f real time file. I want to tail file created last time. The server is gen new file Always. . An example file. -rw-r--r-- 1 shinnie tiituck 251M Oct 18 05:39 20111018_00.log -rw-r--r-- 1 shinnie tiituck 251M Oct 18 11:18 20111018_01.log -rw-r--r-- 1 shinnie tiituck... (3 Replies)
Discussion started by: ooilinlove
3 Replies

5. Shell Programming and Scripting

Shell script to convert epoch time to real time

Dear experts, I have an epoch time input file such as : - 1302451209564 1302483698948 1302485231072 1302490805383 1302519244700 1302492787481 1302505299145 1302506557022 1302532112140 1302501033105 1302511536485 1302512669550 I need the epoch time above to be converted into real... (4 Replies)
Discussion started by: aismann
4 Replies

6. Shell Programming and Scripting

grep - date & time range

Hi, I need to search email files by date & time range in email files. The timezone is not important. Can someone plz advise how i can do this ? For e.g A user can specify only A single date A date range date & time range Below is part of the email file. (4 Replies)
Discussion started by: coolatt
4 Replies

7. Shell Programming and Scripting

Show date/time with tail|grep command

Hi, I have a log file without date/time, and I want that everytime tail|grep find something it displays the date/time and the line. I have tried something like this command but without any luck to display the date/time: tail -F catalina.out | sed "s/^/`date `/" | egrep ... (6 Replies)
Discussion started by: julugu
6 Replies
Login or Register to Ask a Question