7.7. Match and Replace Content in a Text FileTo change the content of a text file by replacing one string (e.g., "orig") with another (e.g., "update"): MSH> get-content file.txt | foreach-object { $_ -replace "orig","update" } | set-content file.txt Filters can be well-suited for repetitive changes to pipeline objects, such as a sequence of files: MSH D:\MshScripts> filter ReplaceInFile { >>param($find,$replace) >>get-content $_ | foreach-object { $_ -replace $find,$replace } | set-content $_ >>} >> MSH D:\MshScripts> get-childitem *.msh | ReplaceInFile "Author:" "Written by:" |