Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Replace text

$
0
0

I’m trying to replace text in a file that is like:

keepthis=something

I want to replace what is after the =

So far I have this:

powershell -Command “(gc test.txt) -replace ‘keepthis=.*?’, ‘keepthis=thisinstead’ | Set-Content test.txt

But with that I end up with:

keepthis=thisinsteadsomething

but I need:

keepthis=thisinstead

submitted by /u/sixinabox
[link] [comments]

The post Replace text appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles