print STDERR "SEARCH STRING: "; $string = <STDIN>; chomp $string; $/ = ""; while(<>){ s/ *\n */ /g; while(/$string/ig){ $count++; $key = $&; $pre = substr ($`, -25); $post = substr ($', 0, 25); $file = $ARGV; $file =~ s#.*/([^/]+)$#$1#; printf "%5d | %s | %25s|%s|%-25.25s\n", $count, $file, $pre, $key, $post; } } exit;