#!/usr/bin/perl eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; while ($ARGV[0] =~ /^-/) { $_ = shift; last if /^--/; if (/^-n/) { $nflag++; next; } die "I don't recognize this switch: $_\\n"; } $printit++ unless $nflag; $\ = "\n"; # automatically add newline on print LINE: while (<>) { chop; if (/text1|text2/) { $printit = 0; next LINE; } } continue { if ($printit) { print; } else { $printit++ unless $nflag; } }