擅长:python、mysql、java
<p>通过perl。你知道吗</p>
<pre><code>$ perl -0777pe 's/<AVP code="123".*?<\/AVP> *\n//sg' file
<AVP code="234" name="ukbkj">
<type>
<enum\>
<type>
<enum\>
<AVP code>
</code></pre>
<p>通过python。你知道吗</p>
<pre><code>import re
with open('file') as f:
m = f.read()
splt = re.findall(r'(?s)<AVP\s+code="\d+".*?</AVP>', m)
for i in splt:
if '<AVP code="123"' not in i:
print(i, end="")
</code></pre>