Link to home
Start Free TrialLog in
Avatar of bkreynolds48
bkreynolds48

asked on

pull string of words out of a file

I have an oracle trace file and want to pull the table name out of the file

FROM "table_name" is how it appears in the file.

I don't know if sed can do this I can't get awk to do this because the file wraps the text.
Avatar of Sean Stuber
Sean Stuber

can you post your trace file?  or at least a snippet you're trying to parse?
Avatar of bkreynolds48

ASKER

Select BEG_VERSION, EXT_VERSION, FIRST_DATE, FIRST_USER, IND_CHANGE,
 INT_VERSION, I_PROJECT, LAST_DATE, LAST_USER, PROJECT_CODE, PROJECT_NAME,
 PRV_VERSION, V_LAST_DATE
FROM
 SNP_PROJECT where I_PROJECT = :1

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        9      0.00       0.00          0          0          0           0
Execute    823      0.02       0.02          0          0          0           0
Fetch      823      0.05       0.05          0       1646          0         823
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total     1655      0.08       0.08          0       1646          0         823

Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 100

Rows     Row Source Operation
-------  ---------------------------------------------------
 1  TABLE ACCESS BY INDEX ROWID SNP_PROJECT (cr=2 pr=0 pw=0 time=0 us cost=1 size=108 card=1)
 1   INDEX UNIQUE SCAN PK_PROJECT (cr=1 pr=0 pw=0 time=0 us cost=0 size=0 card
or it appears in the unformated file like....


Select BEG_VERSION, EXT_VERSION, FIRST_DATE, FIRST_USER, IND_CHANGE, INT_VERSION, I_PROJECT, LAST_DATE, LAST_USER, PROJECT_CODE, PROJECT_NAME, PRV_VERSION, V_LAST_DATE FROM SNP_PROJECT where I_PROJECT = :1

which do you want to parse?

the trace file?
or the tkprof output?
the unformatted trace file

Select BEG_VERSION, EXT_VERSION, FIRST_DATE, FIRST_USER, IND_CHANGE, INT_VERSION, I_PROJECT, LAST_DATE, LAST_USER, PROJECT_CODE, PROJECT_NAME, PRV_VERSION, V_LAST_DATE FROM SNP_PROJECT where I_PROJECT = :1

ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
so how do I run this and capture the output?
you run it on the command line exactly as presented

only change will be you use your own trace file's name where I have "your_trace_file"

thanks much