- 论坛徽章:
- 3
|
我试了下用sed来实现,纯练手。。- $ sed -n '/^Service "syncdb"/{x;:a;$!n;/^\s\+Instance/{H;$!ba};x;p}' urfile
- Service "syncdb" has 1 instance(s).
- Instance "syncdb", status READY, has 1 handler(s) for this service...
- $ sed -n '/^Service "syncdbXDB"/{x;:a;$!n;/^\s\+Instance/{H;$!ba};x;p}' urfile
- Service "syncdbXDB" has 2 instance(s).
- Instance "syncdb1", status READY, has 1 handler(s) for this service...
- Instance "syncdb2", status READY, has 1 handler(s) for this service...
- $ sed -n '/^Service "syncdb_XPT"/{x;:a;$!n;/^\s\+Instance/{H;$!ba};x;p}' urfile
- Service "syncdb_XPT" has 1 instance(s).
- Instance "syncdb", status READY, has 1 handler(s) for this service...
复制代码 |
|