Insert contents of one file into a specific area of another file and saving it

I am a newbie to powershell and I am looking to merge contents of one file into another file

I have 2 files I want to merge the contents

Open 1st file named “config.xml” find Text “trigger”

Insert contents of second file “triggerInfo.txt” into “config.xml” after the word “trigger”

Overwrite modified file “config.xml”

any help would be appreciated

Pete, welcome to Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

What have you tried so far? We expect you to make an own attempt to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

I did a quick research for. Here are some links to start with:

Working with XML

Working with XML Files in Powershell [Parsing]

PowerShell Data Basics: XML

Working with XML Files

… abd there are countless examples more out there. :wink: