#!/usr/bin/perl
# find and print paragraph with desired word
#   author: davidsen@tmr.com 06/10/2010

# state for pg build
$in_pg = 0;

# word to find
$wtf = "find";

while (<>) {
	if (m/^\s*$/) {
		# blank line, if in pg check pattern
		print $pg if $in_pg && $pg =~ m/\W${wtf}\W/;
		$pg = "";
		$in_pg = 0;
	} else {
		# non-blank line, add to pg
		$pg .= $_;
		$in_pg = 1;
	}
}
exit 0;
