搜索和替换工具 [英] Search and replace tool
问题描述
我正在搜索现有工具或编写自己的工具。我甚至考虑过把它写成一种强大的脚本语言;想到PowerShell。如果您使用强大的脚本或应用程序;会是什么?此外,如果可能的话,首选命令行选项。
另外,另一个不错的选择是能够在进行更改之前创建文件的备份。 />
我尝试过:
I am in the process of searching for an existing tool or writing my own. I've even considered writing it a powerful scripting language; PowerShell comes to mind. If you were to use a powerful script or application; what would it be? Also, command line option is preferred, if possible.
Also, another nice nicety would be able to create a backup of the file prior to making the change.
What I have tried:
gci C:\Projects *.config -recurse | ForEach {
(Get-Content $_ | ForEach {$_ -replace "old", "new"}) | Set-Content $_
}
我想要快速而简约的东西。什么都不花哨。
I want something fast and minimal. Nothing fancy.
推荐答案
_ | ForEach {
_ | ForEach {
_ -replaceold,new})| Set-Content
_ -replace "old", "new"}) | Set-Content
_
}
我想要快速而简约的东西。没什么好看的。
I want something fast and minimal. Nothing fancy.
这篇关于搜索和替换工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!