We help IT Professionals succeed at work.

Rename data in the content of a text file using Powershell

High Priority
38 Views
Last Modified: 2020-02-25
I would like a Powershell script to look into the content of text file and where it finds the words 'Tot PC Qty' it should change it to 'Qty'
And resave the file.
Comment
Watch Question

Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016

Commented:
Can you provide a sample of the input file, and desired output file?


»bp
Commented:
$path = "C:\Source.in"
(Get-Content $path).Replace("Tot PC Qty","Qty") | Set-Content $path