#!/usr/bin/perl undef $/; $* = 1; while ( $ARGV = shift ) { if (!open ARGV) { warn "$ARGV: $!\n"; next; } $_ = ; s/\b(\s?)(([A-Za-z]\w*)(\s+\3)+\b)/$1\200$2\200/g || next; split(/\n/); $NR = 0; @hits = (); for (@_) { $NR++; push(@hits, sprintf("%5d %s", $NR, $_)) if /\200/; } $_ = join("\n",@hits); s/\200([^\200]+)\200/[* $1 *]/g; print "$ARGV:\n$_\n"; }