in reply to split file on blank lines and match blocks
trying to identify hosts that are members of the CRIT hostgroup, or of the DMZ hostgroup
Ignoring that your text say's that, and your code 'GRID|RMAN', this might set you on your road:
#! perl -slw use strict; $/ = ''; ## para model see perldoc -q paragraphs m[ (?=^.*(DMZ|CRIT)) (?=^.*host_name\s+(\S+)) (?=^.*address\s+(\S+)) ]sx and print "$2 [$3] is a member of $1" while <DATA>; __DATA__ [snip... your sample data here]
Produces:
C:\test>junk denlas02 [146.xxx.xxx.xxx] is a member of DMZ ppplas12 [10.50.33.26] is a member of CRIT
|
|---|