add tag
3 years ago Anonymous 2321

I’m trying to work out how to do a search and replace to this:

To

So to add in a new line the text “set_attribute…” plus the contents of the preceding square brackets each time eg. in this case that “] <START_SETUP>” is found.

Top Answer
3 years ago PeterVandivier

Assuming your original file is named “foo.txt”, you can regex match for each row and append your additional row as below.

tio

See about_Regular_Expressions for further information on the $matches automatic variable and regex matching in powershell generally.

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.