#! 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__ [snip... your sample data here]