4
是否有方法让PowerShell查找并替换字符串(例如〜}} | {{E)带回车和换行符(\ r \ nE)?在PowerShell中查找/替换带回车符和换行符的字符串
例如:
$filenames = @("E:\blergfest.csv")
foreach ($file in $filenames) {
$outfile = "$file" + ".out"
Get-Content $file | Foreach-object {
$_ -replace '\~}}|{{E', '\r\nE' `
-replace '\|\r\n', '\r\n'
} | Set-Content $outfile
}
那就太过分的要求你有一个像声明“在您的替换文本,使用反引号'\''而不是一个反斜杠''\'',象下面这样:” (?) – 2015-06-11 17:47:45