Perl script for Finding and Replacing certain lines using XML:Twig module
Budget: ₹600 – ₹1,500 INR
I need a perl script to find and replace certain instances in XML files placed in a folder or nested folders. I want this script to be written using XML::Twig module.
If any XML file has an instance like <p product="ProductA ProductB ProductC ProductD">, it should be replaced with <p Pascal="@(ProductA || ProductB || ProductC || ProductD)">.
Similarly, if there are instances of the following:
<p product="ProductA ProductB ProductC ProductD">
<ph otherprops="product:ProductA, ProductB, ProductG">
<ph otherprops="product:ProductA, ProductZ, ProductG, ProductF, Product12">
(For the sake of the conversation I have only mentioned a few Products in the example, like Product A, B, or C. There can be 14-15 products as well.)
They should be replaced with this type of text:
<p Pascal="@(ProductA || ProductB || ProductC || ProductD)">
<ph Pascal="@(ProductA || ProductB || ProductG)">
<ph Pascal="@(ProductA || ProductZ || ProductG || ProductF || Product12)">
If any XML file has an instance like <p product="ProductA ProductB ProductC ProductD">, it should be replaced with <p Pascal="@(ProductA || ProductB || ProductC || ProductD)">.
Similarly, if there are instances of the following:
<p product="ProductA ProductB ProductC ProductD">
<ph otherprops="product:ProductA, ProductB, ProductG">
<ph otherprops="product:ProductA, ProductZ, ProductG, ProductF, Product12">
(For the sake of the conversation I have only mentioned a few Products in the example, like Product A, B, or C. There can be 14-15 products as well.)
They should be replaced with this type of text:
<p Pascal="@(ProductA || ProductB || ProductC || ProductD)">
<ph Pascal="@(ProductA || ProductB || ProductG)">
<ph Pascal="@(ProductA || ProductZ || ProductG || ProductF || Product12)">