xml - SVG 文件:删除每个带有 vim 的对象和内容
问题描述
我有一个包含数千个对象的 SVG 文件,所有这些对象都是<text></text>
or<path></path>
类型。
我需要删除 SVG/XML 中的每个基于文本的对象,同时删除标签和标签各自的内容。文件非常大,我正在寻找单行解决方案。
解决方案
:%s/<text\(\n\|.\)\{-}<\/text>//g
:%s Substitute command, applied to every line.
/ Pattern begins after this character.
<text Opening tag.
\(\n\|.\) Matches carriage returns or any other character.
\{-} Matches previous atom zero or more times but as few as possible.
<\/text> Closing tag.
// Replace with nothing.
g Apply substitution to every match on the line.
推荐阅读
- php - 具有依赖注入的控制器不起作用
- triggers - 访问 Trigger.Apex 测试类中的新值
- javascript - 使用 slice、spread 和 map 进行变异的数组数组
- php - CakePHP 3 中相关表的条件
- azure-devops - 我想要一个构建中的所有项目
- unity3d - 网格表面上的 LineRenderer
- azure - 来宾用户邀请未发送电子邮件
- javascript - 反应:Javascript分配不更新对象
- json - 如何强制 DotNetCore 2.1 Web API 输出 Json 格式?我需要什么图书馆?
- login - Artifactory LDAP 集成问题