question

BB-3218 avatar image
0 Votes"
BB-3218 asked AndreasBaumgarten answered

Change Text in a File with Powershell


I am looking to change the text of a specific line, but leave any remaining text within that file alone. Example:

Line 1 of file: Change Hey, how are you? to Hi, how are you?

I would like to change the Hey to Hi.

Line 2 of file: Hey, how are you?

No changes, leave it be.

Thanks to anyone for your help!

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered

Looks like this is almost the question in a different thread;
https://docs.microsoft.com/en-us/answers/questions/369228/change-specific-text-in-a-file.html

It would be helpful to focus in one thread. I will close this one.


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Chris-84Po-210 avatar image
0 Votes"
Chris-84Po-210 answered

Hi!
Maybe this link will help or give some idea or turn point:
replace-text-with-powershell.aspx


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.