# How to extract the sql from file?

**URL:** <https://community.unix.com/t/how-to-extract-the-sql-from-file/311340>\
**Category:** Shell Programming and Scripting\
**Created:** [June 5, 2012, 7:26am UTC](https://community.unix.com/t/how-to-extract-the-sql-from-file/311340 "2012-06-05T07:26:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![atul9806](https://community.unix.com/user_avatar/community.unix.com/atul9806/32/6647_2.png) [@atul9806](https://community.unix.com/u/atul9806)\
**Post date:** [June 5, 2012, 7:26am UTC](https://community.unix.com/t/how-to-extract-the-sql-from-file/311340/1 "2012-06-05T07:26:54Z")

</div>

Hi Firends  
I have this type of file

```nohighlight
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

---

<div class="post-metadata">

**Author:** ![Franklin52](https://community.unix.com/user_avatar/community.unix.com/franklin52/32/500_2.png) [@Franklin52](https://community.unix.com/u/Franklin52)\
**Post date:** [June 5, 2012, 8:16am UTC](https://community.unix.com/t/how-to-extract-the-sql-from-file/311340/2 "2012-06-05T08:16:42Z")

</div>

Something like this?

```nohighlight
awk '/Rows read/ && $2 > 100 {getline; print; next}' file

```
