Okay, so I've set up a hash table with names being what to replace and keys being what to replace with, like this:
$r = @{
"dog" = "canine";
"cat" = "feline";
"eric" = "eric cartman"
}
What should I do next? I've tried this:
(Get-Content C:\scripts\test.txt) | Foreach-Object {
foreach ( $e in $r.GetEnumerator() ) {
$_ -replace $e.Name, $e.Value
}
} | Set-Content C:\scripts\test.txt.out
But it doesn't work at all, it just writes each line three times, without replacing anything.
EDIT: Contains of test.txt:
dog
cat
eric
test.txt.out:
dog
dog
dog
cat
cat
cat
eric
eric
eric