#!/local/bin/perl #### # # (c) 1998 Bruce Jakeway # # Grep through the definitions for a particular string, returning the headword # and definition. # # Sample run: # ./pgrep word > word.definitions # #### require "getopts.pl"; &Getopts('w'); if ($opt_w) { foreach $arg (@ARGV) { $arg =~ s# #/\\S+ #g; $arg =~ s#^#\\b#; $arg =~ s#$#\\b#; } } @list = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'new', 'o', 'pq', 'r', 's', 't', 'u', 'v', 'w', 'xyz'); foreach $letter (@list) { open (FILE, "/nfs/v2/jakeway/custard/w1913/result/tag/$letter.tag"); while () { if (/^/) { $hw = $_; } else { foreach $arg (@ARGV) { if (/$arg/) { print "$hw\n$_\n"; last; } } } } }