Replace numbers in stings with another number by adding fixed amount to it

by Jun 16, 2013

I am a beginner, sorry.

I think I can replace numbers in a file called "Test.txt" like this (correct me if wrong)

(Get-Content C:ScriptsTest.txt) |
Foreach-Object {$_ -replace "start="20"", "start="40""} |
Set-Content C:ScriptsTest.txt

However my problem is that I want to replace a number in a string with another number that is a fixed amount less than the number I am replacing.

My strings go like this
 start="1342177280"
 start="1342439424"
 start="1342701568"

And what I need to do is deduct 1342177280 from each number giving me

 start="0"
 start="262144"
 start="524288"

Or, setting each value to "0" then incrementing each by 262144 would also work.

There are other numbers in the strings so it is best to replace the complete start="<number>".

Is this possible in PowerShell? I think Perl can do it, but PowerShell may be more convenient.

Thanks!