home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume12 / cake / part09 / Script / double < prev    next >
Encoding:
Text File  |  1987-10-15  |  424 b   |  24 lines

  1. #! /bin/csh -f
  2. foreach file ($*)
  3. cat > /tmp/double$$ << ENDPROG
  4. BEGIN    {
  5.         lastword = "";
  6.         lastfile = "";
  7.     }
  8.     {
  9.     }
  10. NF > 0    {
  11.         if (\$1 == lastword)
  12.             printf "file %s, line %d: double %s\n", "$file", NR, \$1;
  13.  
  14.         for (i = 2; i <= NF; i++)
  15.             if (\$i == \$(i-1))
  16.                 printf "file %s, line %d: double %s\n", "$file", NR, \$i;
  17.  
  18.         lastword = \$NF;
  19.     }
  20. ENDPROG
  21. tr A-Z a-z < $file | awk -f /tmp/double$$
  22. end
  23. /bin/rm -f /tmp/double$$
  24.