我需要用<ATTRIBUTE NAME ="Automatically recover terminated tasks" VALUE ="NO"/>
替换包含<ATTRIBUTE NAME ="Automatically recover terminated tasks" VALUE ="YES"/>
的整行。示例文件如下:
<ATTRIBUTE NAME ="Write Backward Compatible Workflow Log File" VALUE ="NO"/>
<ATTRIBUTE NAME ="Workflow Log File Name" VALUE ="wf_HYB01_HONEYBADGER_DATE_ROLL.log"/>
<ATTRIBUTE NAME ="Workflow Log File Directory" VALUE ="$PMWorkflowLogDir\"/>
<ATTRIBUTE NAME ="Save Workflow log by" VALUE ="By runs"/>
<ATTRIBUTE NAME ="Save workflow log for these runs" VALUE ="$PMWorkflowLogCount"/>
<ATTRIBUTE NAME ="Service Name" VALUE =""/>
<ATTRIBUTE NAME ="Service Timeout" VALUE ="0"/>
<ATTRIBUTE NAME ="Is Service Visible" VALUE ="NO"/>
<ATTRIBUTE NAME ="Is Service Protected" VALUE ="NO"/>
<ATTRIBUTE NAME ="Fail task after wait time" VALUE ="0"/>
<ATTRIBUTE NAME ="Enable HA recovery" VALUE ="NO"/>
<ATTRIBUTE NAME ="Automatically recover terminated tasks" VALUE ="NO"/>
<ATTRIBUTE NAME ="Service Level Name" VALUE ="Default"/>
请帮忙。
答案 0 :(得分:0)
你可以试试这个Single liner sed命令。
sed -i 's/<ATTRIBUTE NAME ="Automatically recover terminated tasks" VALUE ="NO"\/>/<ATTRIBUTE NAME ="Automatically recover terminated tasks" VALUE ="YES"\/>/g filename'
其中filename是样本文件
答案 1 :(得分:0)
在vi编辑器中打开文件并使用以下内容:
:%S /旧句子/替换与 - 新句子/克
如果不想在vi中打开文件,请使用以下内容:
sed -i -e / old-Sentence / Replace-with-New-Sentence / g&#39;文件名