#!/usr/bin/perl -00w

$bold = `/usr/bin/tput smso`;  # A SysVism for the bold-on termcap
$norm = `/usr/bin/tput rmso`;	# A SysVism for the bold-off termcap
($boldpat=$bold) =~ s/(\W)/\\$1/g;

$tag = "[^:\\s]*:\\d+:";

while (<>) {
    if (s/\b(\w+)([ \t\r\f]+|[ \t\r\f]*\n$tag[ \t\r\f]*)\1\b/$bold$1$norm$2$bold$1$norm/gim) {
	print grep(/$boldpat/,split(/^/));
    }
}
