输入文件是
<section_begin> mxsqlc
*** WARNING[13052] Cursor C is not fetched.
<section_end>
<section_begin> b2.lst
*
*** WARNING[13052] Cursor C is not fetched.
0 errors, 1 warnings in SQL C file "b2.ppp".
<section_end>
<section_begin> b2s0
SQLCODE=0
SQLSTATE=00000
a=10, b=abc, c=20
SQLCODE=0
SQLSTATE=00000
a=10, b=abc , c=10, d=xyz
<section_end>
期望没有以下行的输出。
<section_end>
<section_begin> b2s0
我的代码是
perl -ne 'print unless /^\<section_end\>(\s*|.*lst)?\s*$/' b2exp
它删除所有<section_end>
行并且不删除此行<section_begin> *.lst