Hi PowerShell Guru's,
I have an issue like this:
Suppose in a folder i have 3 different type of files:
Line.txt
Line.sql
Line.htm
I have the following code:
$configFiles=get-childitem . *.xml -rec
foreach ($file in $configFiles)
{
(Get-Content $file.PSPath) |
Foreach-Object {$_-replace 'Pro', 'Product'}|
Set-Content $file.PSPath
}
which means when i run the code on this folder, it will search for all the words pro and replaced it by product.
What if I want only to do the change in the line.txt file only?
I tried this code but no outcome :
$configFiles=get-childitem . *.xml -rec
foreach ($file in $configFiles)
{
(Get-Content $file.PSPath) |
Foreach-Object
where-object {$_.extension -ne "*.sql*", "*.htm*"}
Foreach-Object {$_-replace 'Pro', 'Product'}|
Set-Content $file.PSPath
}
can you suggest me something or help me out with the code please