只接用多行匹配就可以了。 / /ms On Jul 20, 2012 2:07 PM, "Gary Jsz" <[email protected]> wrote:
> 大家好! > > 我现在使用正则表达式找到了要匹配的行,但是,需要验证的是这个匹配行的第二行,比如内容如下: > +192.168.0.1:http up > session enabled priority 0 ratio 50 > xxxxx xxxxx > +192.168.0.5:ftp down > session disabled priority 0 ratio 50 > > 我要找到这个ip地址,并确认是否为enable状态,然后,我才能做动作。 > > 在linux的shell中,可以用grep -A 2来匹配,在perl中是否有类似的? 或者语句应该怎么完成? > > 谢谢! > > > -- > [email protected] > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 > 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。 > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 > -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
