【发布时间】:2014-03-17 10:57:19
【问题描述】:
需要删除标签内匹配模式的前后
< mds:insert>
< attributeValues>
< AttrNames
< Item Value="MyContact_c"/>
< /AttrNames>
< /attributeValues>
< /mds:insert>
使用
sed -i -n '/MyContact_c/{s/.*//;x;d;};x;p;${x;p;}' $file
只删除匹配模式前后的行,需要删除 mds:insert 标记内的所有内容...任何指针都会有所帮助。
【问题讨论】:
-
mds:insert块可以嵌套吗? -
你有 gnu grep 吗?用 grep -A, -B -C 可以轻松控制
-
mds:insert 块不是嵌套的..