Can this be done?????????


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can this be done?????????
# 1  
Old 10-19-2011
Can this be done?????????

I am having a file(error.log)with 100 lines.

I need to do the below mentioned steps,

1) I'm grep the particular word "error" from the file (error.log)
-- Assume it grep on line number 49
Cmd : grep -n "error" error.log
O/P : 49: Error File processing
2) I need to grep another word "Thread" from the file (error.log) on line 49 in reverse direction (i.e) grep the word from line no 49 to 1 and get or return the line number from where the word "Thread" matches. Ex: The content of line number 20 will be "Thread Id : 10"
3)Grep the the same word "Thread" till EOF and get the line number from where the word matches last from the file (error.log). Ex : Line number 70 its matches the last match "Thread" return the line number of the last match.

Thanks in advance.
# 2  
Old 10-19-2011
Is this a homework?
# 3  
Old 10-20-2011
No Smilie ... Trying to monitor a logs for errors and report the entire error logs related to that particular thread in a single file.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question