【发布时间】:2017-06-09 23:21:18
【问题描述】:
基本上需要从以 number.xml 命名的一组单独的 XML 文件中删除当事方实体(以及介于两者之间的所有内容)。我尝试了以下方法,但它并不能完全满足我的需求:
cat test.xml | sed "s;<parties>;\do_opentag ;" | sed "s;</parties>;\do_closetag ;" | awk 'BEGIN { doPrint = 1; } /do_opentag/ { doPrint = 0; print $0; } /do_closetag/ { doPrint = 1; } { if (doPrint) print $0; }' | grep -v 'do_opentag\|do_closetag'
<?xml version="1.0" encoding="UTF-8"?>
<patent-document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" pid="58326519" doc-generation-date="2016-10-11">
<bibliographic-data>
<application-reference>
<pan>46422</pan>
</application-reference>
<publication-reference>
<publication-office>KR</publication-office>
<patent-publication-date>
<year>2016</year>
<month>10</month>
<day>11</day>
</patent-publication-date>
</publication-reference>
<parties>
<applicants>
<applicant sequence="1">
<name lang="EN"></name>
<address>
<location-of-work>KR</location-of-work>M
</address>
</applicant>
</applicants>
</parties>
</bibliographic-data>
<vendor>Any</vendor>
<document-translation-date>2016-11-24</document-translation-date>M
<invention-title lang="EN">Cell preservation container for liquid-based cell inspection</invention-title>
<abstract lang="EN">The present invention relates to a liquid for discharging liquid containing cells and cell may be a sampling which is simply eminent generated in </abstract>
<comment lang="EN"></comment>
</patent-document>
【问题讨论】: