in reply to how to remove matched multi lines

Something like this?
#!/usr/bin/perl use strict; $/ = "}"; while ( my $block = <DATA>) { 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 }

Update: Oops, I didn't see the answer of jwkrahn, so ignore this.