这会使我的输出文件加倍!!我怎么才能解决这个问题呢? [英] This keeps doubling my output file!! how can i fix this?
本文介绍了这会使我的输出文件加倍!!我怎么才能解决这个问题呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
它会一直查看您的源文件,然后将这些更改添加到您的输出中,因为源文件没有更改,所以它会一直将这些更改添加到输出中
$data = @(
@{
pattern = "LACTION 'SQL(''logility_prod_scp_logility'',"
replacement = "LACTION 'SQL(''LOGILITY_PROD_SCP_LOGILITY'',"
inputFile = "C:filesDW_FEI_input1.ctg"
outputFile = "C:filesDW_FEI_output1.ctg"
},
@{
pattern = "LACTION 'SQL(''dwfei'',"
replacement = "LACTION 'SQL(''DW_FEI'',"
inputFile = "C:filesDW_FEI_output1.ctg"
outputFile = "C:filesDW_FEI_output2.ctg"
},
@{
pattern = "LACTION 'SQL(''DWFEI'',"
replacement = "LACTION 'SQL(''DW_FEI'',"
inputFile = "C:filesDW_FEI_output2.ctg"
outputFile = "C:filesDW_FEI_output3.ctg"
}
)
$data |
ForEach-Object {
(Get-Content $_.inputFile) -replace $_.pattern, $_.replacement | Out-File $_.outputFile
}
I used above code..trying many other way's as well..how can i make sure my file sizes are not doubled?
我不希望我的文件更改大小..以上所有更改只需在一个输出文件上完成
推荐答案
这是否产生预期结果?
$pattern = "LACTION 'SQL(''DWFEI'',"
$replacement = "LACTION 'SQL(''DW_FEI'',"
(Get-Content "inputfile.txt") -replace $pattern,$replacement |
Out-File "newfile.txt"
这篇关于这会使我的输出文件加倍!!我怎么才能解决这个问题呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文