10-19-2011
6,
0
Join Date: Oct 2011
Last Activity: 28 August 2012, 2:54 PM EDT
Posts: 6
Thanks Given: 1
Thanked 0 Times in 0 Posts
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.