Find and replace between 2 text documents

Hi

First of I don’t know anything about PowerShell, but I think it might be the way to solve my problem.

I have 2 text documents, where I have a lot of text to copy from doc A into doc B - but it is full of variables.
What I need is a way to say: in doc A, find Variable - then copy the first instance of text (similar to) " Line"words here" " Move to doc B, find same Variable and replace " Line"" " with text from doc A.

The Variable is a ID number to match the text, so it will keep changing (ID0001, ID0002 and so on) .

Any guidance is appreciated.

[quote quote=192826]First of I don’t know anything about PowerShell, …

Any guidance is appreciated.[/quote]

You might start with learning the very basics of Powershell. Without that you probably wouldn’t understand the help you get in forums like this one. There are a lot of good sources to start with … some of them free of charge https://powershell.org/free-resources/ … some of them not but worth the money … https://www.amazon.com/s?k=Powershell+book&ref=nb_sb_noss . … and some them even free and entertaining … https://channel9.msdn.com/Series/GetStartedPowerShell3

Good luck and have a lot of fun!

Hi Olaf - Thank you. I guess a better definition is I know enough to be dangerous?
I run commands I am familiar with and have a few on scheduled tasks, but writing from scratch is outside my comfort zone.

I still think you’d be better of by starting with

[quote quote=192985]… I know enough to be dangerous?

… but writing from scratch is outside my comfort zone.[/quote]

Two reasons more for starting with the basics of Powershell. :wink: Another great free source for beginners: Windows-PowerShell TFM 4

Regardless of all that - it will be hard to recommend something meaningful without to know many more details of your task … some example data of your text documents and the relation between the pieces of text you want change.

Probably you will need some of the following cmdlets and statements: Get-Content, Foreach-Object, Select-Object, about_if, about_comparison_operators.
You should always read the complete help including the examples to learn how to use it.