#!/usr/local/bin/perl eval "exec perl -S $0 $*" if $running_under_some_shell; # # Matt Schwab 15Oct94 # if ($#ARGV==-1) { print "Usage: $0 dir keyword [keyword ..]\n"; print "Lists all text (non-binary) files in the directory subtree\n"; print "that contain any of the keywords.\n"; print "\n"; print "See also: Execstat Figstat Wastestat Tour Grepper\n"; exit; } chdir $ARGV[0] || die "Can't chdir to $ARGV[0] \n"; shift @ARGV; open(FIND,"find . -print |") || die "Can't run find: $!\n"; FILE: while ($filename = ) { chop $filename; next FILE unless -T $filename; if (!open(TEXTFILE, $filename)) { print STDERR "Can't open $filename - continuing ...\n"; next FILE; } while () { foreach $word (@ARGV) { if (index($_, $word) >= 0) { print $filename, "\n"; next FILE; } } } }