grep a string with include next 100 line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep a string with include next 100 line
# 1  
Old 11-22-2011
grep a string with include next 100 line

Hi,

I have a log file which has number of lines from that i have to grep a string like this
03:22:19,287
while greping this string i have to grep next lines to the maximum of finding the word (MORE...)

the stack is like this
*************
Code:
22/11/2011 03:22:19,287 232290646 ERROR bnpparibas.grp.invocation.EjbInvoker  - CriticalException: Error on EJB invocation - cause: KeyViolationException: flush failed due to an Oracle intergrity constraint violation
com.bnpparibas.frmk.exception.CriticalException: Error on EJB invocation
        at com.bnpparibas.grp.invocation.EjbInvoker.invokeService(EjbInvoker.java:47)
        at com.bnpparibas.grp.invocation.AbstractInvoker$InvocationHandlerDelegator.invoke(AbstractInvoker.java:63)
        at $Proxy204.processScctFileReceived(Unknown Source)
        at com.bnpparibas.grp.bs.cl.inx.scmsg.analysis.cbf.CBFAnalysisSCMessageConfServices.processReceivedList(CBFAnalysisSCMessageConfServices.java:110)
        at com.bnpparibas.grp.bs.cl.inx.scmsg.analysis.cbf.ejb.CBFAnalysisSCMessageConfServicesEJBSessionBean.processReceivedList(CBFAnalysisSCMessageConfServicesEJBSessionBean.java:68)
......
 at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:247)
        ... 81 more
***************

thanks for the help

Regards
Thelak

Last edited by pludi; 11-22-2011 at 04:28 AM..
# 2  
Old 11-22-2011
Try this...
Code:
sed -n '/03:22:19,287/,/more/p' input_file

You can pipe this to grep and grep whatever you want...

HTH
--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 3  
Old 11-22-2011
thanks alot it's working
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use less pipe for grep or awk sed to print the line not include xx yy zz

cat file |grep -v "xx" | grep -v "yy" |grep -v "zz" (3 Replies)
Discussion started by: yanglei_fage
3 Replies

2. Shell Programming and Scripting

Grep a string from input file and delete next three lines including the line contains string in xml

Hi, 1_strings file contains $ cat 1_strings /home/$USER/Src /home/Valid /home/Review$ cat myxml <projected value="some string" path="/home/$USER/Src"> <input 1/> <estimate value/> <somestring/> </projected> <few more lines > <projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies

3. Shell Programming and Scripting

Grep a string and write a value to next line of found string

Hi, I have two variables x and y. i need to find a particular string in a file, a workflow name and then insert the values of x and y into the next lines of the workflow name. basically it is like as below wf_xxxxxx $$a= $$b= $$c= figo $$d=bentley i need to grep the 'wf_xxxx' and then... (6 Replies)
Discussion started by: angel12345
6 Replies

4. Shell Programming and Scripting

grep on string and printing line after until another string has been found

Hello Everyone, I just started scripting this week. I have no background in programming or scripting. I'm working on a script to grep for a variable in a log file Heres what the log file looks like. The x's are all random clutter xxxxxxxxxxxxxxxxxxxxx START: xxxxxxxxxxxx... (7 Replies)
Discussion started by: rxc23816
7 Replies

5. Shell Programming and Scripting

GREP/SED - get string in a line

Hi, I simply try to get a string in a line but I do smth. wrong. Hopfefully you can help me ;) tried smth like: ggrep -Eo " /folder1/folder2/folder3/* end" get_info_file > temp.file I played a bit around but could not specify the end string command... So this is the... (9 Replies)
Discussion started by: unknown7
9 Replies

6. Shell Programming and Scripting

Grep a string and print a string from the line below it

I know how to grep, copy and paste a string from a line. Now, what i want to do is to find a string and print a string from the line below it. To demonstrate: Name 1: ABC Age: 3 Sex: Male Name 2: DEF Age: 4 Sex: Male Output: 3 Male I know how to get "3". My biggest problem is to... (4 Replies)
Discussion started by: kingpeejay
4 Replies

7. Shell Programming and Scripting

Grep string and next line

Hi i am having a file of more than 60,000 lines. need to grep a string and write the line of string and next line of the grepped string any suggestions (7 Replies)
Discussion started by: karthikn7974
7 Replies

8. Shell Programming and Scripting

grep string and find line before

hi, i have to grep for string in file but i want to find the group of this line so i must get lines before and select the group. the file look like : ####name_groupe1 alphanumeric line alphanumeric line .. ####name_groupe2 alphanumeric line alphanumeric line .. ####name_groupe3... (4 Replies)
Discussion started by: kamel.seg
4 Replies

9. Shell Programming and Scripting

grep the string with the line number

Dear Masters, Here i have some doubts can anyone clarify?. Is it possible to grep the lines by specifying the line numbers. I know the line number which i want to grep. example: grep 40th line filename grep 50th line filename Need ur comments. (4 Replies)
Discussion started by: salaathi
4 Replies

10. UNIX for Dummies Questions & Answers

grep a string in a line using sed

Hi, I'm trying to grep a string in a line using sed. My original data looks like this: MRTG$ grep -i "System" $file <H1>Traffic Analysis for 15 -- sERITHC3602.t-mobile.co.uk</H1> <TABLE> <TR><TD>System:</TD> <TD>sERITHC3602 in </TD></TR> <TR><TD>Maintainer:</TD> <TD></TD></TR>... (4 Replies)
Discussion started by: viadisky
4 Replies
Login or Register to Ask a Question