add text in multiple files



  • Hi,
    I need to insert a text, in multiple files.

    The text is always the same, and the position where I want to insert it is also the same in each file.

    The text is:

    <gmd:descriptiveKeywords>
     <gmd:MD_Keywords>
     <gmd:keyword>
     <gco:CharacterString>open data</gco:CharacterString>
     </gmd:keyword>
     </gmd:MD_Keywords>
    </gmd:descriptiveKeywords>
    

    and I want to put it after the line with this text:

    </gmd:resourceMaintenance>
    

    I think I should use the find and replace with regex, but I don’t know how.

    Stefano



  • @Stefano-Schiavini

    Regular expressions (regex) is the way to go:

    Search for: </gmd:resourceMaintenance>(\R)

    and Replace with: ${0}<gmd:descriptiveKeywords>${1} <gmd:MD_Keywords>${1} <gmd:keyword>${1} <gco:CharacterString>open data</gco:CharacterString>${1} </gmd:keyword>${1} </gmd:MD_Keywords>${1}</gmd:descriptiveKeywords>${1}



  • thank you,

    exactly what I needed.
    works great.

    Stefano


Log in to reply