1825810 Members
2467 Online
109688 Solutions
New Discussion

get a line

 
SOLVED
Go to solution
lawrenzo_1
Super Advisor

get a line

Hi,

I have a file that logs all sql statements in an informix DB.

I would like to print out certain information between each stanza:

=============================== 06:05:00 =======================================
The server did not respond within 5 seconds. Timing out.
The server did not respond within 5 seconds. Timing out.

Informix Dynamic Server 2000 Version 9.21.UC5 -- On-Line (Prim) -- Up 3 days 05:59:03 -- 2027776 Kbytes

session #RSAM total used
id user tty pid hostname threads memory memory
163348 informix - 0 - 0 12288 7840

Memory pools count 1
name class addr totalsize freesize #allocfrag #freefrag
163348 V 942e7020 12288 4448 13 2

name free used name free used
overhead 0 1648 scb 0 96
filetable 0 40 ostcb 0 40
sqscb 0 5928 sql 0 40
fragman 0 48


------------------------------------------------------------------------


session #RSAM total used
id user tty pid hostname threads memory memory
163621 p4uread HOD01702 876 HOD01702 1 118784 115888

tid name rstcb flags curstk status
180109 sqlexec ae75f508 B--PR-- 4696 ae75f508 sleeping(Forever)

Memory pools count 1
name class addr totalsize freesize #allocfrag #freefrag
163621 V 946b6020 118784 2896 349 5

name free used name free used
overhead 0 1648 scb 0 96
opentable 0 19864 filetable 0 2664
misc 0 136 log 0 4200
temprec 0 3144 keys 0 208
ralloc 0 46024 gentcb 0 1328
ostcb 0 2728 sqscb 0 12416
sql 0 40 rdahead 0 832
hashfiletab 0 280 osenv 0 688
buft_buffer 0 4184 sqtcb 0 3584
fragman 0 11744 sapi 0 40

Sess SQL Current Iso Lock SQL ISAM F.E.
Id Stmt type Database Lvl Mode ERR ERR Vers
163621 SELECT data CR Not Wait 0 0 9.03

Current statement name : sql_cur7

Current SQL statement :
SELECT informix.opheadm.order_no ,informix.opheadm.customer
,informix.opheadm.address1 ,informix.opheadm.address2
,informix.opheadm.address3 ,informix.opheadm.address4
,informix.opheadm.address5 ,informix.opheadm.date_entered
,informix.opheadm.transaction_anals2 ,informix.opdetm.product
,informix.opdetm.long_description ,informix.opdetm.nominal_category
,informix.opdetm.value ,informix.opdetm.vat_amount
,informix.quotes.quo_salutation ,informix.quotes.quo_forename
,informix.quotes.quo_surname ,informix.quotes.quo_old_address1
,informix.quotes.quo_bank_account ,informix.quotes.quo_sort_code
,informix.quotes.quo_bank_name FROM
informix.quotes,informix.opheadm,informix.opdetm WHERE
((((informix.opheadm.order_no = informix.quotes.quo_order_no ) AND
(informix.opheadm.date_entered BETWEEN ? AND ? ) ) AND
(informix.opheadm.order_no = informix.opdetm.order_no ) ) AND
(NOT((informix.opdetm.value = 0 ) ) AND (informix.opdetm.line_type IN ('P'
,'S' ) ) ) )

Last parsed SQL statement :
SELECT informix.opheadm.order_no ,informix.opheadm.customer
,informix.opheadm.address1 ,informix.opheadm.address2
,informix.opheadm.address3 ,informix.opheadm.address4
,informix.opheadm.address5 ,informix.opheadm.date_entered
,informix.opheadm.transaction_anals2 ,informix.opdetm.product
,informix.opdetm.long_description ,informix.opdetm.nominal_category
,informix.opdetm.value ,informix.opdetm.vat_amount
,informix.quotes.quo_salutation ,informix.quotes.quo_forename
,informix.quotes.quo_surname ,informix.quotes.quo_old_address1
,informix.quotes.quo_bank_account ,informix.quotes.quo_sort_code
,informix.quotes.quo_bank_name FROM
informix.quotes,informix.opheadm,informix.opdetm WHERE
((((informix.opheadm.order_no = informix.quotes.quo_order_no ) AND
(informix.opheadm.date_entered BETWEEN ? AND ? ) ) AND
(informix.opheadm.order_no = informix.opdetm.order_no ) ) AND
(NOT((informix.opdetm.value = 0 ) ) AND (informix.opdetm.line_type IN ('P'
,'S' ) ) ) )


------------------------------------------------------------------------
=============================== 06:10:00 =======================================

etc etc

I am looking to print the time the information was collected and then information from between the below stanza for each occurrance of p4uread and the sql statement being run, not to bothered about the print format:

time user sql:



once again any help is greatly appreciated.

Cheers

Chris


hello
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: get a line

Hi Chris:

See if this fits your needs:

# sed -ne '/^===/p' -e '/p4uread/,/^Last parsed/p' file

Regards!

...JRF...
Sandman!
Honored Contributor

Re: get a line

Please clarify your requirements because your post is somewhat confusing.

~thanks
lawrenzo_1
Super Advisor

Re: get a line

Thanks for the code,

I have adapted and used with awk.
hello