string parsing using UNIX

I got multple sql files.such as
>>vi abc.sql

select A.SITENAME,
NULL
NULL
A.CREATE_DTM
NULL
A.MODIFY_DTM
NULL
FROM ${STG_RET_ITEM} A INNER JOIN ${STG_INC_COMP} B ON (A.CUSTID=B.CUSTID)
LEFT OUTER JOIN ( select C.SITEID,SITESTATUS,MIN_EFF_DT,CURR_ST_DT,MAX_IN_DT,MAX_ACT_DT
from ${STG_LOC_REG} C

I want to print all file names along with table name like below

abc.sql  STG_RET_ITEM  STG_INC_COMP
abc.sql  STG_LOC_REG
..............................
............................

Can somebody help me achieve this.
Thanks
Ali

Is the table name already in ${ ... } ?

I just want to extract text between ${} along with file name.
as below

abc.sql STG_RET_ITEM STG_INC_COMP
abc.sql STG_LOC_REG
awk -F "[}|{]" '/{/{print FILENAME , $2,$4}' abc.sql
1 Like

Thanks.its working great.