Hello friends,
I have a C source code containing sql statements. I use the following sed command to print all the sql blocks in the source code....
sed -n "/exec sql/,/;/p" Sample.cpp
The above sed command will print the sql blocks based on the pattern "exec sql" & ";" (since most of them start with "exec" & ends in ";") & the output will look like this (with no ">>>>")
1>>>> exec sql select pqxQrn,
pqxPmeOldQcl
into :qrn, :qxt, :cuk, :cln, :pqxTdd,
:pmeOldQcl indicator :pmeOldQclInd
from pqx
1>>>>where pqxDno = :dno;
2>>>>exec sql select qcfQcl into :oldQcl from qcf
1>>>> where qcfCuk = :cuk;
2>>>> exec sql select cufCid
into :cid
from cuf
1>>>>where cufCuk = :cuk;
2>>>> exec sql select clrChief
into :chief
from clr
1>>>> where clrCln = :cln;
2>>>> exec sql select count(*) into :cnt from pqx
1>>>> where pqxQrn < :qrn;
2>>>> exec sql declare xqxPmeCur cursor for
select pqxQrn
from pqx
where pqxQxt = QXT_PME and
pqxCuk = :cuk and
pqxPmeDno = :dno and
1>>>> pqxTdd = :pqxTdd;
2>>>> exec sql open xqxPmeCur;
I would like to insert a space in between each sql blocks (between "1>>>>" & "2>>>>").....so that it is more readable. Kindly help....& thanks in advance.....