home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / perl / scripts-convex / showdupes < prev    next >
Encoding:
Text File  |  1991-08-04  |  414 b   |  19 lines

  1. #!/usr/bin/perl
  2. undef $/; 
  3. $* = 1;
  4. while ( $ARGV = shift ) { 
  5.     if (!open ARGV) { warn "$ARGV: $!\n"; next; } 
  6.     $_ = <ARGV>;
  7.     s/\b(\s?)(([A-Za-z]\w*)(\s+\3)+\b)/$1\200$2\200/g || next;
  8.     split(/\n/);
  9.     $NR = 0;
  10.     @hits = ();
  11.     for (@_) { 
  12.     $NR++;
  13.     push(@hits, sprintf("%5d %s", $NR, $_)) if /\200/;
  14.     } 
  15.     $_ = join("\n",@hits);
  16.     s/\200([^\200]+)\200/[* $1 *]/g;
  17.     print "$ARGV:\n$_\n";
  18. }
  19.