Operating System - HP-UX
1755740 Members
3374 Online
108837 Solutions
New Discussion юеВ

Re: Shell scripting question

 
SOLVED
Go to solution
Ridzuan Zakaria
Frequent Advisor

Shell scripting question

Hi,

Does anyone know how to get extract the following message from below log.

LLINE1 : CREATE OR REPLACE PACKAGE BODY dbms_repcat_utl wrapped
*
LINE2: ERROR at line 1:

LINE3: ORA-04031: unable to allocate 4160 bytes of shared memory ("shared
pool","unknown object","sga heap(1,0)","state objects")

If would like to grep any ORA-04031 error in LINE3 together with message from LINE1 (i.e CREATE OR REPLACE PACKAGE BODY dbms_repcat_utl wrapped)

How do I do that in Korn Shell? "grep ORA-04031" will only return LINE3.

Thanks in advance
quest for perfections
3 REPLIES 3
Sundar_7
Honored Contributor

Re: Shell scripting question

awk '$1 ~ /CREATE/ { LINE1=$0; getline; getline LINE3; if( LINE3 ~ /.*ORA-04031.*/) printf("%s\n%s\n",LINE1,LIN
E3) }'

Wait for sometime - I am sure people will come up with better scripts :-)
Learn What to do ,How to do and more importantly When to do ?
Abdul Rahiman
Esteemed Contributor
Solution

Re: Shell scripting question

Have a look at this thread.. similar discussion,
look especially the ggrep, greb and perl solutions..

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=630972

regds,
Abdul.
No unix, no fun
Ridzuan Zakaria
Frequent Advisor

Re: Shell scripting question

Thanks.
quest for perfections