#!/usr/bin/perl use strict; $/ = "}"; while ( my $block = ) { print $block if ( $block !~ /\b\Q192.168.1.1\E\b/ ); } __DATA__ define host{ use windows-server host_name serverA hostgroups 060202 alias 060202 contact_groups yu address 192.168.1.1 } define host{ use windows-server host_name serverA hostgroups 060202 alias 060202 contact_groups yu address 192.168.1.11 }