How to extract the sql from file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to extract the sql from file?
# 1  
Old 06-05-2012
How to extract the sql from file?

Hi Firends
I have this type of file
Code:
Rows read                          = 4823832
Statement  text                     = SELECT QUEUE, REPLY_QUEUE, REPLY_QMGR FROM  HUB_REF.CORNERSTONE.HUB_REF_QUEUE AS RQ WHERE  (RQ.SERVICE_NAME =  'modifyParty' OR RQ.SERVICE_NAME = '*')  AND RQ.SERVICE_TYPE = 'REQ' AND RQ.VERSION = 'NA' AND RQ.TARGET ='MARS'
Rows read                          = 0
Statement  text                     = SELECT  BSB_NUMBER,NAME,STREET,POSTCODE,SUBURB,STATE   FROM HUB_REF.CORNERSTONE.HUB_REF_BANK AS BANK WHERE BANK.BSB_NUMBER LIKE '%013762%'
Rows read                          = 482
Statement text                     = SELECT BSB_NUMBER,
Rows read                          = 0
Statement text                     =vbnmkliu  

I need the SQL statement where Rows read > 100

I am trying to extract it but unable to do please help ?

Thanks

Last edited by Scrutinizer; 06-05-2012 at 09:46 AM.. Reason: formatting
# 2  
Old 06-05-2012
Something like this?
Code:
awk '/Rows read/ && $2 > 100 {getline; print; next}' file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ksh: How to write the log file simultaneously when .sql file executes by UNIX process

Hello Team- we would like to implement an approach which has to write the log file simultaneously when .sql file is executing by Unix process. At present,it is writing the log file once the process is completed. I've tested the current process with the below approaches and none of them... (1 Reply)
Discussion started by: Hima_B
1 Replies

2. Shell Programming and Scripting

Extract Oracle sql queries from .fmb and .rdf files

Hi all, Thanks for your time! Regards, (1 Reply)
Discussion started by: a1_win
1 Replies

3. Shell Programming and Scripting

[Solved] Using AWK to extract SQL result

I just wish to extract the result onli... but I dont which edit to perform to start from (**) :wall: Current display result SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 24 14:14:49 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g... (4 Replies)
Discussion started by: ment0smintz
4 Replies

4. UNIX for Dummies Questions & Answers

Hot to retrieve *.sql file names which we refer in .sh file.

Hi Guys, How to retrieve/get *.sql file names which we refer in all *.sh files. Can any one help me on this. Thanks, Kolipaka (3 Replies)
Discussion started by: lakshmanrk811
3 Replies

5. Shell Programming and Scripting

Extract text from a SQL Script

Hi All, I want to extact text which start with "Group" case insenstive and end with ";" and in between there should be "partition"(case insenstive) . I write a script, but that script also giving me FILE2.txt and file3.txt as outputs. I shouldn't get anything from file2 and file3. Beacuse... (1 Reply)
Discussion started by: molakal9
1 Replies

6. Shell Programming and Scripting

How to extract WHERE clause from a SQL using UNIX???

Hi, I need to know how to extract entire WHERE clause from a SQL statement using UNIX command. For example: If following is the SQL then how to extract entire WHERE clause: UPDATE <TABLE_NAME_1> SET <FIELD_NAME> = VALUE WHERE CONDITION_1 AND CONDITION_2 = (SELECT FIELD_NAME FROM... (15 Replies)
Discussion started by: ustechie
15 Replies

7. UNIX for Advanced & Expert Users

Extract Oracle DB Connect and SQL execution log

Hi, I am trying to write a generic script as a part of a framework which will establish Oracle DB connection once and loops in to check for some files which gives the SQL statements to execute. The script is running but I am stuck with capturing errors ( ORA and SP) and outputs. Example: ... (4 Replies)
Discussion started by: mirage0809
4 Replies

8. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

9. UNIX for Dummies Questions & Answers

Execute PL/SQL function from Unix script (.sql file)

Hi guys, I am new on here, I have a function in oracle that returns a specific value: create or replace PACKAGE BODY "CTC_ASDGET_SCHED" AS FUNCTION FN_ASDSCHEDULE_GET RETURN VARCHAR2 AS BEGIN DECLARE ASDSchedule varchar2(6); ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies

10. Shell Programming and Scripting

Need to extract .sql files

Hi, I am trying to extract all .sql files present in a particular directory and its sub directories. How can i do this using shell script or awk? any help would be earnestly appreciated. thanks. (1 Reply)
Discussion started by: sprinleo
1 Replies
Login or Register to Ask a Question