Find and replace the column in perl
Simple requirement need to find the string A.FIND_REPLCAE column in <SQL>,</SQL> and replcae with trim(A.FIND_REPLCAE) in <SQL> </SQL> in XML.txt file as given below example
Input(evey time line numbers will change)
this is @12th line <SQL><SelectStatement modified=\\'1\\' type=\\'string\\'><![CDATA[
SEL A.COLUMN_NMAE1,
A.FIND_REPLCAE
FROM TABLE_NAME
\><Tables collapsed=\\'1\\'></Tables><Parameters collapsed=\\'1\\'></Parameters><Columns collapsed=\\'1\\'></Columns></SelectStatement><SQL>
this is @150 line <SQL><SelectStatement modified='1' type='string'><![CDATA[ SEL A.COLUMN_NMAE1, \(D)\(A) A.FIND_REPLCAE FROM TABLE_NAME]]><Tables collapsed='1'></Tables><Parameters collapsed='1'></Parameters><Columns collapsed='1'></Columns></SelectStatement></SQL>
my output:-
<SQL><SelectStatement modified=\\'1\\' type=\\'string\\'><![CDATA[
SEL A.COLUMN_NMAE1,
Trim(A.FIND_REPLCAE)
FROM TABLE_NAME
\><Tables collapsed=\\'1\\'></Tables><Parameters collapsed=\\'1\\'></Parameters><Columns collapsed=\\'1\\'></Columns></SelectStatement><SQL>
<SQL><SelectStatement modified='1' type='string'><![CDATA[ SEL A.COLUMN_NMAE1, \(D)\(A) Trim(A.FIND_REPLCAE) FROM TABLE_NAME]]><Tables collapsed='1'></Tables><Parameters collapsed='1'></Parameters><Columns collapsed='1'></Columns></SelectStatement></SQL>
|