我试图删除两个模式之间的行(Beginn:info / End:}),其中匹配一个字符串。
这是我的档案:
# bla bla
# bla bla
# bla bla
# bla bla
nnssjnds nkjdnds "nsrnsnmks" ffsns {
is on or off at 9:12:43 23/02/2015;
is nass or trocken at 08:32:12 22/02/2015;
}
info text01text {
beginn 30/04/2015 10:00:04;
end 30/04/2015 19:00:04;
check1 30/04/2015 11:30:04;
check2 30/04/2015 13:00:04;
check3 30/04/2015 16:00:04;
Check4 30/04/2015 18:00:04;
build top end;
mix water 0102030456789;
xim "43ndf392rfhf<DF>3}";
test space = "ALLFINE";
eman cpre "ann";
}
info text02text {
beginn 30/04/2015 10:00:04;
end 30/04/2015 19:00:04;
check1 30/04/2015 11:30:04;
check2 30/04/2015 13:00:04;
check3 30/04/2015 16:00:04;
Check4 30/04/2015 18:00:04;
build top end;
mix water 0202030456789;
xim "43ndf392rfhf<DF>3";
test space2 = "ALLFINE2";
eman cpre2 "ann2";
}
info text03text {
beginn 30/04/2015 10:00:04;
end 30/04/2015 19:00:04;
check1 30/04/2015 11:30:04;
check2 30/04/2015 13:00:04;
check3 30/04/2015 16:00:04;
Check4 30/04/2015 18:00:04;
build top end;
mix water 0302030456789;
xim "43ndf392rfhf<DF>3";
test space3 = "ALLFINE3";
eman cpre3 "ann3";
}
我的sed脚本
:point
/^info/,/^}/ {
/}/!{
$!{
N;
bpoint
}
}
/0202030456789/d;
}
我的sed脚本使用字符串0202030456789
正常工作,并删除从信息text02text {
到}
的所有行。
尝试使用0102030456789
中的字符串text01text
,然后从第&#34行删除sed
到}
。 xim&#34; 43ndf392rfhf3}&#34;;&#34;和行
test space = "ALLFINE";
eman cpre "ann";
}
不要删除。
如何删除找到字符串的所有行?
谢谢!