Take a look at Select-String. It will allow you to find the entire line that contains what you are looking for. Then you can update the line.
This is a sample file
apple = yummy
bananna = yummy
pear = awful
grapes = divine
Say I want to replace the line containing "pear". First get the line:
$line = Get-Content c:empest.txt | Select-String pear | Select-Object -ExpandProperty Line
Now we just read in the content and replace the line with our line:
$content = Get-Content c:empest.txt
$content | ForEach-Object {$_ -replace $line,"pear = amazing"} | Set-Content c:empest.txt
Confirm the changes
Get-Content C:empest.txt
apple = yummy
bananna = yummy
pear = amazing
grapes = divine
Note that if you are working with XML, which it looks like you might be you can open the document as an XML document and simply replace the attribute. Without seeing a sample of your source file its hard to tell.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…