1
<ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="Penguin-CL-Nest-s1" ServerIOTimeoutRetry="-1">
我试图做的是一个查找和替换,其中字符串匹配IgnoreAffinityRequests =“true”和企鹅-CL-巢S1或S2,那么当匹配的字符串真正应更换与假。
enterIgnoreAffinityRequests="true"
Name="Penguin-CL-Nest-s1"
Name="Penguin-CL-Nest-s2"
这里是我使用SLES11.3
sed -i -r -e '/IgnoreAffinityRequests="true"/{;/Name="Penguin-CL-Nest-\w\d"/s/IgnoreAffinityRequests="true"/IgnoreAffinityRequests="false"/;}' example1
它确实没有正则表达式的工作,任何帮助,衷心感谢,感谢命令。
sed -i -e '/IgnoreAffinityRequests="true"/{;/Name="Penguin-CL-Nest-s1"/s/IgnoreAffinityRequests="true"/IgnoreAffinityRequests="false"/;}' example1
然后你可以使用像'sed'/ Name =“Penguin-CL-Nest-s [12]/s/IgnoreAffinityRequests =”true“/ IgnoreAffinityRequests =”false“/''' s/IgnoreAffinityRequests =“true”/ IgnoreAffinityRequests =“false”/'在符合'/ Name =“Penguin-CL-Nest-s [12] /'的行中。基本形式是'/ pattern/command',如果模式空间(行,或者在前面的命令中编辑行的结果)匹配'pattern','command'将被执行。 – Wintermute 2015-02-06 09:58:34