Read file and then replace word from csv file
i want replace words in config files, replace valor value in csv file example:
user new user
abc qwr
wer 123456
i want search word "abc" , replace "qwr"
i write not know how add
$configfiles=get-childitem . *.config -rec
foreach ($file in $configfiles)
{
$file.pspath >> log.log
$a= "" + $file.pspath + ".bkp"
cp $file.pspath $a
(get-content $file.pspath) |
foreach-object {$_ -replace "decchi", "mono"} |
set-content $file.pspath
}
adecchi
hope helps! jason
Windows Server > Windows PowerShell
Comments
Post a Comment