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> |
please use [code]<here comes your script>[/code] tags to keep formatting (please try to edit your original post).
Also please give us more details. Probably you have a perl script already, what did you try (to modify), what's happened.... looks like duplicate of https://www.linuxquestions.org/quest...ce-4175615766/ |
Yes. Please use [code] [/code] tags around your perl script. For example like this,
Code:
#!/usr/bin/perl |
All times are GMT -5. The time now is 08:13 AM. |