[英]Sed to replace specified line via powershell script
Invoking command to manage a virtual machine and trying to pass sed command but I'm unable to escape certain characters resulting in many syntax error messages. 调用命令来管理虚拟机并尝试传递sed命令,但是我无法转义某些字符,从而导致出现许多语法错误消息。
Powershell script: -ScriptText 'sed -i '61s#.*# < property name="jobExecutionIntervalInHours" value="24A" /> #
' filepath ' Powershell脚本:-ScriptText'sed
'61s#.*# < property name="jobExecutionIntervalInHours" value="24A" /> #
'filepath'
Tried that... please let me know 尝试过...请让我知道
Much appreciated 非常感激
This is a bit difficult without knowing more about the capabilities of your native sed
command and shell
. 如果不进一步了解本地
sed
命令和shell
的功能,这将有些困难。 The following command should be portable to all POSIX compliant versions of sed
and shells that support redirectors >
. 以下命令应可移植到支持重定向程序
>
所有POSIX兼容版本的sed
和shell中。
sed '61s/.*/ < property name="jobExecutionIntervalInHours" value="24A" /g' oldfile > newfile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.