Visit The New, Modern Unix Linux Community


Parse 'sections' of the file and print


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Parse 'sections' of the file and print
# 1  
Parse 'sections' of the file and print

Hi,


This file is a trace/monitoring file generated by Oracle. Unfortunately, they do not have the tool to parse it 'properly' to get the information that I am after.


Basically, I am after the values of the variables in question. I have customer specific information from the attachment. The information that I am after are bind variables from a SQL statement run by the user.


For example, the SQL query below


Code:
INSERT INTO XYZ.XYZ_OMG_BUGSBUNNY (OHMYGOD_REF_NO,OHMYGOD_CREATION_DUCK_GMT,OHMYGOD_RCC,OHMYGOD_VERSION_NO,XYZ_ABC_ID,BUGSBUNNY_SEQ_NO,MICKEY_MESSAGE_DUCKTIME,PUBLISHER_MESSAGE_DUCKTIME,BUGSBUNNY_TYPE,BUGSBUNNY_PARTY_TYPE,BUGSBUNNY_TITLE,BUGSBUNNY_DONJUAN_STATUS,BUGSBUNNY_GIVEN_NAME,BUGSBUNNY_SURNAME,BUGSBUNNY_OTHER_NAMES,BUGSBUNNY_GROUP_NUMBER,CREATED_BY,DSS_CREATE_DUCKTIME)VALUES(:1 ,:2 ,:3 ,:4 ,:5 ,:6 ,:7 ,:8 ,:9 ,:10 ,:11 ,:12 ,:13 ,:14 ,:15 ,:16 ,:17 ,SYSDUCK)


The bind variables are :1 to :17. Somewhere in the trace files, information about this variables are in the section
Code:
----- Bind Info (kkscoacd) -----

and
Code:
----------------------------------------

.


Excerpts from the tracefile example below:


Code:
----- Bind Info (kkscoacd) -----
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7ff69bb095e8  bln=24  avl=05  flg=05
  value=61455379
 Bind#1
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7ff69bb095b8  bln=24  avl=02  flg=05
  value=1


...
...
...




 Bind#35
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7ff69bb09618  bln=24  avl=06  flg=05
  value=2179711620
 Frames pfr 0x7ff69bb08650 siz=30584 efr 0x7ff69bb08508 siz=30528
 Cursor frame dump
  enxt: 11.0x000005c0  enxt: 10.0x00000fd8  enxt: 9.0x00000fa0  enxt: 8.0x00000658
  enxt: 7.0x00000fd8  enxt: 6.0x00000fa0  enxt: 5.0x00000248  enxt: 4.0x00000fa0
  enxt: 3.0x00000638  enxt: 2.0x00000480  enxt: 1.0x00000f98
  pnxt: 1.0x00000038
 kxscphp=0x7ff69bb00cd0 siz=2792 inu=1024 nps=416
 kxscbhp=0x7ff69bb00f10 siz=10376 inu=10008 nps=8768

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

Don't know why I have up to Bind#35 but I do Smilie. Anyway, I need help on how to parse the tracefiles and print out the Bind#<nn>. I don't want to print all the information within the section, I just want the bind number, the oacdty and value?


Example output below:


Code:
Bind Values Set 1:

Bind#0 oacdty=02 value=61455379
Bind#1 oacdty=02 value=1
...
...
Bind#35 oacdty=02 value=2179711620


Bind Values Set 2:

Bind#0 oacdty=02 value=61455379
Bind#1 oacdty=02 value=1
...
...
Bind#35 oacdty=02 value=2179711620



and so on

# 2  
Please post the script you have designed and written so far, to solve your problem.

Please put some effort into your own script and try; and when you post your best attempt, please post all sample input, output, error messages and your script.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #433
Difficulty: Easy
JSON, or JavaScript Object Notation, is a general-purpose data interchange format that is defined as a subset of JavaScript's object literal syntax.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help on parsing Oracle RMAN output for string and print sections of a file

Hi, I need some advise on how to print 'sections' of the attached file. I am searching for some that says Marked Corrupt and print some lines after it. At the moment I am running the command below: sed -n -e '/Marked Corrupt/{N;N;p;}' rman_list_validate.txtThis gives me the following... (1 Reply)
Discussion started by: newbie_01
1 Replies

2. Shell Programming and Scripting

Omitting sections of file that contain word

I have a configuration file that contains hundreds of these chunks. Each "chunk" is the section that begins with "define service {" and ends with "}". define service { check_command check_proc!java hostgroup_name service_description ... (5 Replies)
Discussion started by: SkySmart
5 Replies

3. Shell Programming and Scripting

awk removing sections of a file

I have a file that looks liek this (see below). can somebody provide me with and awk or sed command that can take a piece of the file starting from the time to the blank line and put in into another file. For example: How would I get the data from 10:56:11 to the blank line. Two things: ... (5 Replies)
Discussion started by: BeefStu
5 Replies

4. Programming

extract different sections of a file

Hi All, I have a file with the data 10;20;30;40;50;60;70;80;123;145;156;345. the output i want is the first fourth sixth elements and everything from there on. How do i achieve this. (1 Reply)
Discussion started by: raghu_shekar
1 Replies

5. Shell Programming and Scripting

Modify sections of the line in a file

Hello.. I have a line in a file which I have to edit: the line looks like: <!]> Sometimes, the section of the line can have only one entry for cn, or maybe more than 2 like below: <!]> I have a variable which has the following value: CN="(cn=MNO)(cn=XYZ)" I need to replace the part... (4 Replies)
Discussion started by: chiru_h
4 Replies

6. Shell Programming and Scripting

Parsing file, yaml file? Extracting specific sections

Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Discussion started by: Rhije
3 Replies

7. Shell Programming and Scripting

Best way to remove sections of text from a file

Greetings! I found this fourm via a google search on "sed expressions". I have a file that contains notices and they are all the same length in lines. For example the file would contains 15 notices, each being 26 lines each. I need some way to eliminate notices that contain a "S" in a particular... (8 Replies)
Discussion started by: cals64
8 Replies

8. Shell Programming and Scripting

extract multiple sections of file

I have a file that I need to parse multiple sections from the file. The file contains multiple lines that start with ST (Abunch of data) Then the file contains multiple lines that start with SE (Abunch of data) SE*30*0001 ST*810*0002 I need all of the lines between and including these.... (6 Replies)
Discussion started by: rgentis
6 Replies

9. UNIX for Advanced & Expert Users

extract multiple sections of a file

I have a file that I need to parse multiple sections from the file. The file contains multiple lines that start with ST (Abunch of data) Then the file contains multiple lines that start with SE (Abunch of data) SE*30*0001 ... (1 Reply)
Discussion started by: rgentis
1 Replies

10. Shell Programming and Scripting

To parse through the file and print output using awk or sed script

suppose if u have a file like that Hen ABCCSGSGSGJJJJK 15 Cock ABCCSGGGSGIJJJL 15 * * * * * * : * * * . * * * : Hen CFCDFCSDFCDERTF 30 Cock CHCDFCSDHCDEGFI 30 * . * * * * * * * : * * :* : : . The output shud be where there is : and . It shud... (4 Replies)
Discussion started by: cdfd123
4 Replies

Featured Tech Videos