open NAG, '<', 'nagios' or die "Cannot open 'nagios' $!"; $/ = "}\n"; while ( ) { print if /\b192\.168\.1\.1\b/; }